mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
libvirt: Introduce virConnectGetStoragePoolCapabilities
Introduce the API to expose the storage pool capabilities along with all the remote munglement required to hook up the client. Signed-off-by: John Ferlan <jferlan@redhat.com> ACKed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
784cd46fb8
commit
6696155ae6
@ -193,6 +193,10 @@ typedef enum {
|
||||
*/
|
||||
virConnectPtr virStoragePoolGetConnect (virStoragePoolPtr pool);
|
||||
|
||||
/* Storage Pool capabilities */
|
||||
char *virConnectGetStoragePoolCapabilities(virConnectPtr conn,
|
||||
unsigned int flags);
|
||||
|
||||
/*
|
||||
* List active storage pools
|
||||
*/
|
||||
|
@ -52,6 +52,10 @@ typedef char *
|
||||
const char *srcSpec,
|
||||
unsigned int flags);
|
||||
|
||||
typedef char *
|
||||
(*virDrvConnectGetStoragePoolCapabilities)(virConnectPtr conn,
|
||||
unsigned int flags);
|
||||
|
||||
typedef virStoragePoolPtr
|
||||
(*virDrvStoragePoolLookupByName)(virConnectPtr conn,
|
||||
const char *name);
|
||||
@ -237,6 +241,7 @@ struct _virStorageDriver {
|
||||
virDrvConnectFindStoragePoolSources connectFindStoragePoolSources;
|
||||
virDrvConnectStoragePoolEventRegisterAny connectStoragePoolEventRegisterAny;
|
||||
virDrvConnectStoragePoolEventDeregisterAny connectStoragePoolEventDeregisterAny;
|
||||
virDrvConnectGetStoragePoolCapabilities connectGetStoragePoolCapabilities;
|
||||
virDrvStoragePoolLookupByName storagePoolLookupByName;
|
||||
virDrvStoragePoolLookupByUUID storagePoolLookupByUUID;
|
||||
virDrvStoragePoolLookupByVolume storagePoolLookupByVolume;
|
||||
|
@ -2351,3 +2351,43 @@ virConnectStoragePoolEventDeregisterAny(virConnectPtr conn,
|
||||
virDispatchError(conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virConnectGetStoragePoolCapabilities:
|
||||
* @conn: pointer to the hypervisor connection
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Prior creating a storage pool (for instance via virStoragePoolCreateXML
|
||||
* or virStoragePoolDefineXML) it may be suitable to know what pool types
|
||||
* are supported along with the file/disk formats for each pool.
|
||||
*
|
||||
* Returns NULL in case of error or an XML string defining the capabilities.
|
||||
*/
|
||||
char *
|
||||
virConnectGetStoragePoolCapabilities(virConnectPtr conn,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("conn=%p, flags=0x%x", conn, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
virCheckConnectReturn(conn, NULL);
|
||||
|
||||
if (conn->storageDriver &&
|
||||
conn->storageDriver->connectGetStoragePoolCapabilities) {
|
||||
char *ret;
|
||||
ret = conn->storageDriver->connectGetStoragePoolCapabilities(conn,
|
||||
flags);
|
||||
if (!ret)
|
||||
goto error;
|
||||
VIR_DEBUG("conn=%p, ret=%s", conn, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
|
||||
error:
|
||||
virDispatchError(conn);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -814,4 +814,9 @@ LIBVIRT_4.10.0 {
|
||||
virDomainSetIOThreadParams;
|
||||
} LIBVIRT_4.5.0;
|
||||
|
||||
LIBVIRT_5.2.0 {
|
||||
global:
|
||||
virConnectGetStoragePoolCapabilities;
|
||||
} LIBVIRT_4.10.0;
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
@ -8572,6 +8572,7 @@ static virStorageDriver storage_driver = {
|
||||
.connectFindStoragePoolSources = remoteConnectFindStoragePoolSources, /* 0.4.5 */
|
||||
.connectStoragePoolEventDeregisterAny = remoteConnectStoragePoolEventDeregisterAny, /* 2.0.0 */
|
||||
.connectStoragePoolEventRegisterAny = remoteConnectStoragePoolEventRegisterAny, /* 2.0.0 */
|
||||
.connectGetStoragePoolCapabilities = remoteConnectGetStoragePoolCapabilities, /* 5.2.0 */
|
||||
.storagePoolLookupByName = remoteStoragePoolLookupByName, /* 0.4.1 */
|
||||
.storagePoolLookupByUUID = remoteStoragePoolLookupByUUID, /* 0.4.1 */
|
||||
.storagePoolLookupByVolume = remoteStoragePoolLookupByVolume, /* 0.4.1 */
|
||||
|
@ -3565,6 +3565,14 @@ struct remote_connect_list_all_nwfilter_bindings_ret { /* insert@1 */
|
||||
unsigned int ret;
|
||||
};
|
||||
|
||||
struct remote_connect_get_storage_pool_capabilities_args {
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_connect_get_storage_pool_capabilities_ret {
|
||||
remote_nonnull_string capabilities;
|
||||
};
|
||||
|
||||
/*----- Protocol. -----*/
|
||||
|
||||
/* Define the program number, protocol version and procedure numbers here. */
|
||||
@ -6328,6 +6336,11 @@ enum remote_procedure {
|
||||
* @acl: domain:save:!VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE
|
||||
* @acl: domain:save:VIR_DOMAIN_AFFECT_CONFIG
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_SET_IOTHREAD_PARAMS = 402
|
||||
REMOTE_PROC_DOMAIN_SET_IOTHREAD_PARAMS = 402,
|
||||
|
||||
/**
|
||||
* @generate: both
|
||||
* @acl: connect:read
|
||||
*/
|
||||
REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES = 403
|
||||
};
|
||||
|
@ -2975,6 +2975,12 @@ struct remote_connect_list_all_nwfilter_bindings_ret {
|
||||
} bindings;
|
||||
u_int ret;
|
||||
};
|
||||
struct remote_connect_get_storage_pool_capabilities_args {
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_connect_get_storage_pool_capabilities_ret {
|
||||
remote_nonnull_string capabilities;
|
||||
};
|
||||
enum remote_procedure {
|
||||
REMOTE_PROC_CONNECT_OPEN = 1,
|
||||
REMOTE_PROC_CONNECT_CLOSE = 2,
|
||||
@ -3378,4 +3384,5 @@ enum remote_procedure {
|
||||
REMOTE_PROC_NWFILTER_BINDING_DELETE = 400,
|
||||
REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS = 401,
|
||||
REMOTE_PROC_DOMAIN_SET_IOTHREAD_PARAMS = 402,
|
||||
REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES = 403,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user