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;
 }
Esempio n. 2
0
/**
 * fetch a list of volume_virt_id from the virt host in _MEDIA_POOL_
 *
 * @global  resource $host_conn libvirt connection
 *
 * @return  array|bool          volume_virt_id list or FALSE on error
 */
function ace_kvm_get_media_list()
{
    global $host_conn;
    $volume_pool_name = _MEDIA_POOL_;
    $volume_pool_res = libvirt_storagepool_lookup_by_name($host_conn, $volume_pool_name);
    ace_kvm_log_last_error();
    libvirt_storagepool_refresh($volume_pool_res);
    ace_kvm_log_last_error();
    $volume_list = libvirt_storagepool_list_volumes($volume_pool_res);
    ace_kvm_log_last_error();
    return $volume_list;
}