function storagepool_get_volume_information($pool, $name = false)
 {
     if (!is_resource($pool)) {
         $pool = $this->get_storagepool_res($pool);
     }
     if (!$pool) {
         return false;
     }
     $out = array();
     $tmp = libvirt_storagepool_list_volumes($pool);
     for ($i = 0; $i < sizeof($tmp); $i++) {
         if ($tmp[$i] == $name || $name == false) {
             $r = libvirt_storagevolume_lookup_by_name($pool, $tmp[$i]);
             $out[$tmp[$i]] = libvirt_storagevolume_get_info($r);
             $out[$tmp[$i]]['path'] = libvirt_storagevolume_get_path($r);
             unset($r);
         }
     }
     return $out;
 }
Example #2
0
/**
 * delete a volume in _IMAGE_POOL_ on the virt host
 *
 * @global  resource $host_conn      libvirt connection
 *
 * @param   string   $volume_virt_id virt_id of the volume
 *
 * @return  bool                TRUE on success | FALSE on error
 */
function ace_kvm_volume_delete($volume_virt_id)
{
    global $host_conn;
    $volume_pool_name = _IMAGE_POOL_;
    $volume_pool_res = libvirt_storagepool_lookup_by_name($host_conn, $volume_pool_name);
    ace_kvm_log_last_error();
    $volume_res = libvirt_storagevolume_lookup_by_name($volume_pool_res, $volume_virt_id);
    ace_kvm_log_last_error();
    $success = libvirt_storagevolume_delete($volume_res);
    ace_kvm_log_last_error();
    return $success;
}