mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
Remote driver plumbing for virStorageVolCreateXMLFrom
This commit is contained in:
parent
5b31c7d08a
commit
885de7f8cf
@ -1,3 +1,12 @@
|
|||||||
|
Tue May 12 16:11:14 EDT 2009 Cole Robinson <crobinso@redhat.com>
|
||||||
|
|
||||||
|
* qemud/remote.c qemud/remote_dispatch_args.h
|
||||||
|
qemud/remote_dispatch_prototypes.h qemud/remote_distpatch_ret.h
|
||||||
|
qemud/remote_dispatch_table.h qemud/remote_protocol.c
|
||||||
|
qemud/remote_protocol.h qemud/remote_protocol.x
|
||||||
|
src/remote_internal.c:
|
||||||
|
Remote support for virStorageVolCreateXMLFrom
|
||||||
|
|
||||||
Tue May 12 16:00:49 EDT 2009 Cole Robinson <crobinso@redhat.com>
|
Tue May 12 16:00:49 EDT 2009 Cole Robinson <crobinso@redhat.com>
|
||||||
|
|
||||||
* include/libvirt/libvirt.h include/libvirt/libvirt.c
|
* include/libvirt/libvirt.h include/libvirt/libvirt.c
|
||||||
|
@ -3831,6 +3831,40 @@ remoteDispatchStorageVolCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDispatchStorageVolCreateXmlFrom (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_error *rerr,
|
||||||
|
remote_storage_vol_create_xml_from_args *args,
|
||||||
|
remote_storage_vol_create_xml_from_ret *ret)
|
||||||
|
{
|
||||||
|
virStoragePoolPtr pool;
|
||||||
|
virStorageVolPtr clonevol, newvol;
|
||||||
|
|
||||||
|
pool = get_nonnull_storage_pool (conn, args->pool);
|
||||||
|
if (pool == NULL) {
|
||||||
|
remoteDispatchConnError(rerr, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
clonevol = get_nonnull_storage_vol (conn, args->clonevol);
|
||||||
|
if (clonevol == NULL) {
|
||||||
|
remoteDispatchConnError(rerr, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
newvol = virStorageVolCreateXMLFrom (pool, args->xml, clonevol,
|
||||||
|
args->flags);
|
||||||
|
if (newvol == NULL) {
|
||||||
|
remoteDispatchConnError(rerr, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
make_nonnull_storage_vol (&ret->vol, newvol);
|
||||||
|
virStorageVolFree(newvol);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
|
remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
@ -105,3 +105,4 @@
|
|||||||
remote_domain_get_security_label_args val_remote_domain_get_security_label_args;
|
remote_domain_get_security_label_args val_remote_domain_get_security_label_args;
|
||||||
remote_node_device_create_xml_args val_remote_node_device_create_xml_args;
|
remote_node_device_create_xml_args val_remote_node_device_create_xml_args;
|
||||||
remote_node_device_destroy_args val_remote_node_device_destroy_args;
|
remote_node_device_destroy_args val_remote_node_device_destroy_args;
|
||||||
|
remote_storage_vol_create_xml_from_args val_remote_storage_vol_create_xml_from_args;
|
||||||
|
@ -814,6 +814,13 @@ static int remoteDispatchStorageVolCreateXml(
|
|||||||
remote_error *err,
|
remote_error *err,
|
||||||
remote_storage_vol_create_xml_args *args,
|
remote_storage_vol_create_xml_args *args,
|
||||||
remote_storage_vol_create_xml_ret *ret);
|
remote_storage_vol_create_xml_ret *ret);
|
||||||
|
static int remoteDispatchStorageVolCreateXmlFrom(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_error *err,
|
||||||
|
remote_storage_vol_create_xml_from_args *args,
|
||||||
|
remote_storage_vol_create_xml_from_ret *ret);
|
||||||
static int remoteDispatchStorageVolDelete(
|
static int remoteDispatchStorageVolDelete(
|
||||||
struct qemud_server *server,
|
struct qemud_server *server,
|
||||||
struct qemud_client *client,
|
struct qemud_client *client,
|
||||||
|
@ -89,3 +89,4 @@
|
|||||||
remote_domain_get_security_label_ret val_remote_domain_get_security_label_ret;
|
remote_domain_get_security_label_ret val_remote_domain_get_security_label_ret;
|
||||||
remote_node_get_security_model_ret val_remote_node_get_security_model_ret;
|
remote_node_get_security_model_ret val_remote_node_get_security_model_ret;
|
||||||
remote_node_device_create_xml_ret val_remote_node_device_create_xml_ret;
|
remote_node_device_create_xml_ret val_remote_node_device_create_xml_ret;
|
||||||
|
remote_storage_vol_create_xml_from_ret val_remote_storage_vol_create_xml_from_ret;
|
||||||
|
@ -627,3 +627,8 @@
|
|||||||
.args_filter = (xdrproc_t) xdr_remote_node_device_destroy_args,
|
.args_filter = (xdrproc_t) xdr_remote_node_device_destroy_args,
|
||||||
.ret_filter = (xdrproc_t) xdr_void,
|
.ret_filter = (xdrproc_t) xdr_void,
|
||||||
},
|
},
|
||||||
|
{ /* StorageVolCreateXmlFrom => 125 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchStorageVolCreateXmlFrom,
|
||||||
|
.args_filter = (xdrproc_t) xdr_remote_storage_vol_create_xml_from_args,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_remote_storage_vol_create_xml_from_ret,
|
||||||
|
},
|
||||||
|
@ -1991,6 +1991,30 @@ xdr_remote_storage_vol_create_xml_ret (XDR *xdrs, remote_storage_vol_create_xml_
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_storage_vol_create_xml_from_args (XDR *xdrs, remote_storage_vol_create_xml_from_args *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_storage_pool (xdrs, &objp->pool))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_remote_nonnull_string (xdrs, &objp->xml))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_remote_nonnull_storage_vol (xdrs, &objp->clonevol))
|
||||||
|
return FALSE;
|
||||||
|
if (!xdr_u_int (xdrs, &objp->flags))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_storage_vol_create_xml_from_ret (XDR *xdrs, remote_storage_vol_create_xml_from_ret *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_storage_vol (xdrs, &objp->vol))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
xdr_remote_storage_vol_delete_args (XDR *xdrs, remote_storage_vol_delete_args *objp)
|
xdr_remote_storage_vol_delete_args (XDR *xdrs, remote_storage_vol_delete_args *objp)
|
||||||
{
|
{
|
||||||
|
@ -1120,6 +1120,19 @@ struct remote_storage_vol_create_xml_ret {
|
|||||||
};
|
};
|
||||||
typedef struct remote_storage_vol_create_xml_ret remote_storage_vol_create_xml_ret;
|
typedef struct remote_storage_vol_create_xml_ret remote_storage_vol_create_xml_ret;
|
||||||
|
|
||||||
|
struct remote_storage_vol_create_xml_from_args {
|
||||||
|
remote_nonnull_storage_pool pool;
|
||||||
|
remote_nonnull_string xml;
|
||||||
|
remote_nonnull_storage_vol clonevol;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
typedef struct remote_storage_vol_create_xml_from_args remote_storage_vol_create_xml_from_args;
|
||||||
|
|
||||||
|
struct remote_storage_vol_create_xml_from_ret {
|
||||||
|
remote_nonnull_storage_vol vol;
|
||||||
|
};
|
||||||
|
typedef struct remote_storage_vol_create_xml_from_ret remote_storage_vol_create_xml_from_ret;
|
||||||
|
|
||||||
struct remote_storage_vol_delete_args {
|
struct remote_storage_vol_delete_args {
|
||||||
remote_nonnull_storage_vol vol;
|
remote_nonnull_storage_vol vol;
|
||||||
u_int flags;
|
u_int flags;
|
||||||
@ -1415,6 +1428,7 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_NODE_GET_SECURITY_MODEL = 122,
|
REMOTE_PROC_NODE_GET_SECURITY_MODEL = 122,
|
||||||
REMOTE_PROC_NODE_DEVICE_CREATE_XML = 123,
|
REMOTE_PROC_NODE_DEVICE_CREATE_XML = 123,
|
||||||
REMOTE_PROC_NODE_DEVICE_DESTROY = 124,
|
REMOTE_PROC_NODE_DEVICE_DESTROY = 124,
|
||||||
|
REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM = 125,
|
||||||
};
|
};
|
||||||
typedef enum remote_procedure remote_procedure;
|
typedef enum remote_procedure remote_procedure;
|
||||||
|
|
||||||
@ -1623,6 +1637,8 @@ extern bool_t xdr_remote_storage_vol_lookup_by_path_args (XDR *, remote_storage
|
|||||||
extern bool_t xdr_remote_storage_vol_lookup_by_path_ret (XDR *, remote_storage_vol_lookup_by_path_ret*);
|
extern bool_t xdr_remote_storage_vol_lookup_by_path_ret (XDR *, remote_storage_vol_lookup_by_path_ret*);
|
||||||
extern bool_t xdr_remote_storage_vol_create_xml_args (XDR *, remote_storage_vol_create_xml_args*);
|
extern bool_t xdr_remote_storage_vol_create_xml_args (XDR *, remote_storage_vol_create_xml_args*);
|
||||||
extern bool_t xdr_remote_storage_vol_create_xml_ret (XDR *, remote_storage_vol_create_xml_ret*);
|
extern bool_t xdr_remote_storage_vol_create_xml_ret (XDR *, remote_storage_vol_create_xml_ret*);
|
||||||
|
extern bool_t xdr_remote_storage_vol_create_xml_from_args (XDR *, remote_storage_vol_create_xml_from_args*);
|
||||||
|
extern bool_t xdr_remote_storage_vol_create_xml_from_ret (XDR *, remote_storage_vol_create_xml_from_ret*);
|
||||||
extern bool_t xdr_remote_storage_vol_delete_args (XDR *, remote_storage_vol_delete_args*);
|
extern bool_t xdr_remote_storage_vol_delete_args (XDR *, remote_storage_vol_delete_args*);
|
||||||
extern bool_t xdr_remote_storage_vol_dump_xml_args (XDR *, remote_storage_vol_dump_xml_args*);
|
extern bool_t xdr_remote_storage_vol_dump_xml_args (XDR *, remote_storage_vol_dump_xml_args*);
|
||||||
extern bool_t xdr_remote_storage_vol_dump_xml_ret (XDR *, remote_storage_vol_dump_xml_ret*);
|
extern bool_t xdr_remote_storage_vol_dump_xml_ret (XDR *, remote_storage_vol_dump_xml_ret*);
|
||||||
@ -1837,6 +1853,8 @@ extern bool_t xdr_remote_storage_vol_lookup_by_path_args ();
|
|||||||
extern bool_t xdr_remote_storage_vol_lookup_by_path_ret ();
|
extern bool_t xdr_remote_storage_vol_lookup_by_path_ret ();
|
||||||
extern bool_t xdr_remote_storage_vol_create_xml_args ();
|
extern bool_t xdr_remote_storage_vol_create_xml_args ();
|
||||||
extern bool_t xdr_remote_storage_vol_create_xml_ret ();
|
extern bool_t xdr_remote_storage_vol_create_xml_ret ();
|
||||||
|
extern bool_t xdr_remote_storage_vol_create_xml_from_args ();
|
||||||
|
extern bool_t xdr_remote_storage_vol_create_xml_from_ret ();
|
||||||
extern bool_t xdr_remote_storage_vol_delete_args ();
|
extern bool_t xdr_remote_storage_vol_delete_args ();
|
||||||
extern bool_t xdr_remote_storage_vol_dump_xml_args ();
|
extern bool_t xdr_remote_storage_vol_dump_xml_args ();
|
||||||
extern bool_t xdr_remote_storage_vol_dump_xml_ret ();
|
extern bool_t xdr_remote_storage_vol_dump_xml_ret ();
|
||||||
|
@ -1002,6 +1002,17 @@ struct remote_storage_vol_create_xml_ret {
|
|||||||
remote_nonnull_storage_vol vol;
|
remote_nonnull_storage_vol vol;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct remote_storage_vol_create_xml_from_args {
|
||||||
|
remote_nonnull_storage_pool pool;
|
||||||
|
remote_nonnull_string xml;
|
||||||
|
remote_nonnull_storage_vol clonevol;
|
||||||
|
unsigned flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_storage_vol_create_xml_from_ret {
|
||||||
|
remote_nonnull_storage_vol vol;
|
||||||
|
};
|
||||||
|
|
||||||
struct remote_storage_vol_delete_args {
|
struct remote_storage_vol_delete_args {
|
||||||
remote_nonnull_storage_vol vol;
|
remote_nonnull_storage_vol vol;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
@ -1286,7 +1297,9 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_NODE_GET_SECURITY_MODEL = 122,
|
REMOTE_PROC_NODE_GET_SECURITY_MODEL = 122,
|
||||||
|
|
||||||
REMOTE_PROC_NODE_DEVICE_CREATE_XML = 123,
|
REMOTE_PROC_NODE_DEVICE_CREATE_XML = 123,
|
||||||
REMOTE_PROC_NODE_DEVICE_DESTROY = 124
|
REMOTE_PROC_NODE_DEVICE_DESTROY = 124,
|
||||||
|
|
||||||
|
REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM = 125
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Custom RPC structure. */
|
/* Custom RPC structure. */
|
||||||
|
@ -4499,6 +4499,38 @@ done:
|
|||||||
return vol;
|
return vol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static virStorageVolPtr
|
||||||
|
remoteStorageVolCreateXMLFrom (virStoragePoolPtr pool,
|
||||||
|
const char *xmlDesc,
|
||||||
|
virStorageVolPtr clonevol,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
virStorageVolPtr newvol = NULL;
|
||||||
|
remote_storage_vol_create_xml_from_args args;
|
||||||
|
remote_storage_vol_create_xml_from_ret ret;
|
||||||
|
struct private_data *priv = pool->conn->storagePrivateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_storage_pool (&args.pool, pool);
|
||||||
|
make_nonnull_storage_vol (&args.clonevol, clonevol);
|
||||||
|
args.xml = (char *) xmlDesc;
|
||||||
|
args.flags = flags;
|
||||||
|
|
||||||
|
memset (&ret, 0, sizeof ret);
|
||||||
|
if (call (pool->conn, priv, 0, REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM,
|
||||||
|
(xdrproc_t) xdr_remote_storage_vol_create_xml_from_args, (char *) &args,
|
||||||
|
(xdrproc_t) xdr_remote_storage_vol_create_xml_from_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
newvol = get_nonnull_storage_vol (pool->conn, ret.vol);
|
||||||
|
xdr_free ((xdrproc_t) &xdr_remote_storage_vol_create_xml_from_ret, (char *) &ret);
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return newvol;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteStorageVolDelete (virStorageVolPtr vol,
|
remoteStorageVolDelete (virStorageVolPtr vol,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
@ -7018,6 +7050,7 @@ static virStorageDriver storage_driver = {
|
|||||||
.volLookupByKey = remoteStorageVolLookupByKey,
|
.volLookupByKey = remoteStorageVolLookupByKey,
|
||||||
.volLookupByPath = remoteStorageVolLookupByPath,
|
.volLookupByPath = remoteStorageVolLookupByPath,
|
||||||
.volCreateXML = remoteStorageVolCreateXML,
|
.volCreateXML = remoteStorageVolCreateXML,
|
||||||
|
.volCreateXMLFrom = remoteStorageVolCreateXMLFrom,
|
||||||
.volDelete = remoteStorageVolDelete,
|
.volDelete = remoteStorageVolDelete,
|
||||||
.volGetInfo = remoteStorageVolGetInfo,
|
.volGetInfo = remoteStorageVolGetInfo,
|
||||||
.volGetXMLDesc = remoteStorageVolDumpXML,
|
.volGetXMLDesc = remoteStorageVolDumpXML,
|
||||||
|
Loading…
Reference in New Issue
Block a user