mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 01:04:59 +00:00
list: Define new API virStoragePoolListAllVolumes
Simply returns the storage volume objects. No supported filter flags. include/libvirt/libvirt.h.in: Declare the API python/generator.py: Skip the function for generating. virStoragePool.py will be added in later patch. src/driver.h: virDrvStoragePoolListVolumesFlags src/libvirt.c: Implementation for the API. src/libvirt_public.syms: Export the symbol to public
This commit is contained in:
parent
aa7c4068a8
commit
a42eac601e
@ -2654,6 +2654,9 @@ int virStoragePoolNumOfVolumes (virStoragePoolPtr pool)
|
||||
int virStoragePoolListVolumes (virStoragePoolPtr pool,
|
||||
char **const names,
|
||||
int maxnames);
|
||||
int virStoragePoolListAllVolumes (virStoragePoolPtr pool,
|
||||
virStorageVolPtr **vols,
|
||||
unsigned int flags);
|
||||
|
||||
virConnectPtr virStorageVolGetConnect (virStorageVolPtr vol);
|
||||
|
||||
|
@ -461,6 +461,7 @@ skip_function = (
|
||||
'virDomainListAllSnapshots', # overridden in virDomain.py
|
||||
'virDomainSnapshotListAllChildren', # overridden in virDomainSnapshot.py
|
||||
'virConnectListAllStoragePools', # overridden in virConnect.py
|
||||
'virStoragePoolListAllVolumes', # overridden in virStoragePool.py
|
||||
|
||||
'virStreamRecvAll', # Pure python libvirt-override-virStream.py
|
||||
'virStreamSendAll', # Pure python libvirt-override-virStream.py
|
||||
|
@ -1311,7 +1311,10 @@ typedef int
|
||||
(*virDrvStoragePoolListVolumes) (virStoragePoolPtr pool,
|
||||
char **const names,
|
||||
int maxnames);
|
||||
|
||||
typedef int
|
||||
(*virDrvStoragePoolListAllVolumes) (virStoragePoolPtr pool,
|
||||
virStorageVolPtr **vols,
|
||||
unsigned int flags);
|
||||
|
||||
typedef virStorageVolPtr
|
||||
(*virDrvStorageVolLookupByName) (virStoragePoolPtr pool,
|
||||
@ -1419,6 +1422,7 @@ struct _virStorageDriver {
|
||||
virDrvStoragePoolSetAutostart poolSetAutostart;
|
||||
virDrvStoragePoolNumOfVolumes poolNumOfVolumes;
|
||||
virDrvStoragePoolListVolumes poolListVolumes;
|
||||
virDrvStoragePoolListAllVolumes poolListAllVolumes;
|
||||
|
||||
virDrvStorageVolLookupByName volLookupByName;
|
||||
virDrvStorageVolLookupByKey volLookupByKey;
|
||||
|
@ -12596,6 +12596,54 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virStoragePoolListAllVolumes:
|
||||
* @pool: Pointer to storage pool
|
||||
* @vols: Pointer to a variable to store the array containing storage volume
|
||||
* objects or NULL if the list is not required (just returns number
|
||||
* of volumes).
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Collect the list of storage volumes, and allocate an array to store those
|
||||
* objects.
|
||||
*
|
||||
* Returns the number of storage volumes found or -1 and sets @vols to
|
||||
* NULL in case of error. On success, the array stored into @vols is
|
||||
* guaranteed to have an extra allocated element set to NULL but not included
|
||||
* in the return count, to make iteration easier. The caller is responsible
|
||||
* for calling virStorageVolFree() on each array element, then calling
|
||||
* free() on @vols.
|
||||
*/
|
||||
int
|
||||
virStoragePoolListAllVolumes(virStoragePoolPtr pool,
|
||||
virStorageVolPtr **vols,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("pool=%p, vols=%p, flags=%x", pool, vols, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_STORAGE_POOL(pool)) {
|
||||
virLibConnError(VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pool->conn->storageDriver &&
|
||||
pool->conn->storageDriver->poolListAllVolumes) {
|
||||
int ret;
|
||||
ret = pool->conn->storageDriver->poolListAllVolumes(pool, vols, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(pool->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virStoragePoolNumOfVolumes:
|
||||
@ -12643,6 +12691,8 @@ error:
|
||||
* Fetch list of storage volume names, limiting to
|
||||
* at most maxnames.
|
||||
*
|
||||
* To list the volume objects directly, see virStoragePoolListAllVolumes().
|
||||
*
|
||||
* Returns the number of names fetched, or -1 on error
|
||||
*/
|
||||
int
|
||||
|
@ -557,6 +557,7 @@ LIBVIRT_0.10.0 {
|
||||
LIBVIRT_0.10.2 {
|
||||
global:
|
||||
virConnectListAllStoragePools;
|
||||
virStoragePoolListAllVolumes;
|
||||
} LIBVIRT_0.10.0;
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
Loading…
Reference in New Issue
Block a user