Re: [libvirt] [PATCH 2/7] Remote driver plumbing for virStorageVolCreateXMLFrom

2009-05-11 Thread Daniel P. Berrange
On Mon, May 04, 2009 at 01:42:57PM -0400, Cole Robinson wrote:
> 
> Signed-off-by: Cole Robinson 
> ---
>  qemud/remote.c |   34 ++
>  qemud/remote_dispatch_args.h   |1 +
>  qemud/remote_dispatch_prototypes.h |7 +++
>  qemud/remote_dispatch_ret.h|1 +
>  qemud/remote_dispatch_table.h  |5 +
>  qemud/remote_protocol.c|   24 
>  qemud/remote_protocol.h|   18 ++
>  qemud/remote_protocol.x|   15 ++-
>  src/remote_internal.c  |   33 +
>  9 files changed, 137 insertions(+), 1 deletions(-)

ACK, all fine, boring stuff.

Daniel

> 
> diff --git a/qemud/remote.c b/qemud/remote.c
> index 8d24a3a..5ba9430 100644
> --- a/qemud/remote.c
> +++ b/qemud/remote.c
> @@ -3831,6 +3831,40 @@ remoteDispatchStorageVolCreateXml (struct qemud_server 
> *server ATTRIBUTE_UNUSED,
>  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, args->flags,
> + clonevol);
> +if (newvol == NULL) {
> +remoteDispatchConnError(rerr, conn);
> +return -1;
> +}
> +
> +make_nonnull_storage_vol (&ret->vol, newvol);
> +virStorageVolFree(newvol);
> +return 0;
> +}
>  
>  static int
>  remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
> diff --git a/qemud/remote_dispatch_args.h b/qemud/remote_dispatch_args.h
> index 58eccf5..8f8b05b 100644
> --- a/qemud/remote_dispatch_args.h
> +++ b/qemud/remote_dispatch_args.h
> @@ -105,3 +105,4 @@
>  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_destroy_args val_remote_node_device_destroy_args;
> +remote_storage_vol_create_xml_from_args 
> val_remote_storage_vol_create_xml_from_args;
> diff --git a/qemud/remote_dispatch_prototypes.h 
> b/qemud/remote_dispatch_prototypes.h
> index 96dcb2a..1a2d98b 100644
> --- a/qemud/remote_dispatch_prototypes.h
> +++ b/qemud/remote_dispatch_prototypes.h
> @@ -814,6 +814,13 @@ static int remoteDispatchStorageVolCreateXml(
>  remote_error *err,
>  remote_storage_vol_create_xml_args *args,
>  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(
>  struct qemud_server *server,
>  struct qemud_client *client,
> diff --git a/qemud/remote_dispatch_ret.h b/qemud/remote_dispatch_ret.h
> index 3325c8b..75e2ca6 100644
> --- a/qemud/remote_dispatch_ret.h
> +++ b/qemud/remote_dispatch_ret.h
> @@ -89,3 +89,4 @@
>  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_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;
> diff --git a/qemud/remote_dispatch_table.h b/qemud/remote_dispatch_table.h
> index ac7f9b9..e601a6c 100644
> --- a/qemud/remote_dispatch_table.h
> +++ b/qemud/remote_dispatch_table.h
> @@ -627,3 +627,8 @@
>  .args_filter = (xdrproc_t) xdr_remote_node_device_destroy_args,
>  .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,
> +},
> diff --git a/qemud/remote_protocol.c b/qemud/remote_protocol.c
> index af3c792..738f95c 100644
> --- a/qemu

[libvirt] [PATCH 2/7] Remote driver plumbing for virStorageVolCreateXMLFrom

2009-05-04 Thread Cole Robinson

Signed-off-by: Cole Robinson 
---
 qemud/remote.c |   34 ++
 qemud/remote_dispatch_args.h   |1 +
 qemud/remote_dispatch_prototypes.h |7 +++
 qemud/remote_dispatch_ret.h|1 +
 qemud/remote_dispatch_table.h  |5 +
 qemud/remote_protocol.c|   24 
 qemud/remote_protocol.h|   18 ++
 qemud/remote_protocol.x|   15 ++-
 src/remote_internal.c  |   33 +
 9 files changed, 137 insertions(+), 1 deletions(-)

diff --git a/qemud/remote.c b/qemud/remote.c
index 8d24a3a..5ba9430 100644
--- a/qemud/remote.c
+++ b/qemud/remote.c
@@ -3831,6 +3831,40 @@ remoteDispatchStorageVolCreateXml (struct qemud_server 
*server ATTRIBUTE_UNUSED,
 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, args->flags,
+ clonevol);
+if (newvol == NULL) {
+remoteDispatchConnError(rerr, conn);
+return -1;
+}
+
+make_nonnull_storage_vol (&ret->vol, newvol);
+virStorageVolFree(newvol);
+return 0;
+}
 
 static int
 remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
diff --git a/qemud/remote_dispatch_args.h b/qemud/remote_dispatch_args.h
index 58eccf5..8f8b05b 100644
--- a/qemud/remote_dispatch_args.h
+++ b/qemud/remote_dispatch_args.h
@@ -105,3 +105,4 @@
 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_destroy_args val_remote_node_device_destroy_args;
+remote_storage_vol_create_xml_from_args 
val_remote_storage_vol_create_xml_from_args;
diff --git a/qemud/remote_dispatch_prototypes.h 
b/qemud/remote_dispatch_prototypes.h
index 96dcb2a..1a2d98b 100644
--- a/qemud/remote_dispatch_prototypes.h
+++ b/qemud/remote_dispatch_prototypes.h
@@ -814,6 +814,13 @@ static int remoteDispatchStorageVolCreateXml(
 remote_error *err,
 remote_storage_vol_create_xml_args *args,
 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(
 struct qemud_server *server,
 struct qemud_client *client,
diff --git a/qemud/remote_dispatch_ret.h b/qemud/remote_dispatch_ret.h
index 3325c8b..75e2ca6 100644
--- a/qemud/remote_dispatch_ret.h
+++ b/qemud/remote_dispatch_ret.h
@@ -89,3 +89,4 @@
 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_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;
diff --git a/qemud/remote_dispatch_table.h b/qemud/remote_dispatch_table.h
index ac7f9b9..e601a6c 100644
--- a/qemud/remote_dispatch_table.h
+++ b/qemud/remote_dispatch_table.h
@@ -627,3 +627,8 @@
 .args_filter = (xdrproc_t) xdr_remote_node_device_destroy_args,
 .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,
+},
diff --git a/qemud/remote_protocol.c b/qemud/remote_protocol.c
index af3c792..738f95c 100644
--- a/qemud/remote_protocol.c
+++ b/qemud/remote_protocol.c
@@ -1992,6 +1992,30 @@ xdr_remote_storage_vol_create_xml_ret (XDR *xdrs, 
remote_storage_vol_create_xml_
 }
 
 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))
+