[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/6] Remote protocol impl for virDomainUpdateDeviceFlags



This defines the wire format for the new virDomainUpdateDeviceFlags()
API, and implements the server & client side of the marshalling code.

* daemon/remote.c: Server side dispatch for virDomainUpdateDeviceFlags
* src/remote/remote_driver.c: Client side serialization for
  virDomainUpdateDeviceFlags
* src/remote/remote_protocol.x: Define wire format for
  virDomainUpdateDeviceFlags
* daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_table.h, src/remote/remote_protocol.c,
  src/remote/remote_protocol.h: Re-generate code
---
 daemon/remote.c                     |   26 ++++++++++++++++++++++++++
 daemon/remote_dispatch_args.h       |    1 +
 daemon/remote_dispatch_prototypes.h |    8 ++++++++
 daemon/remote_dispatch_table.h      |    5 +++++
 src/remote/remote_driver.c          |   28 +++++++++++++++++++++++++++-
 src/remote/remote_protocol.c        |   13 +++++++++++++
 src/remote/remote_protocol.h        |   10 ++++++++++
 src/remote/remote_protocol.x        |    9 ++++++++-
 8 files changed, 98 insertions(+), 2 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 1b02143..0673351 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -916,6 +916,32 @@ remoteDispatchDomainAttachDeviceFlags (struct qemud_server *server ATTRIBUTE_UNU
 }
 
 static int
+remoteDispatchDomainUpdateDeviceFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
+                                       struct qemud_client *client ATTRIBUTE_UNUSED,
+                                       virConnectPtr conn,
+                                       remote_message_header *hdr ATTRIBUTE_UNUSED,
+                                       remote_error *rerr,
+                                       remote_domain_update_device_flags_args *args,
+                                       void *ret ATTRIBUTE_UNUSED)
+{
+    virDomainPtr dom;
+
+    dom = get_nonnull_domain (conn, args->dom);
+    if (dom == NULL) {
+        remoteDispatchConnError(rerr, conn);
+        return -1;
+    }
+
+    if (virDomainUpdateDeviceFlags (dom, args->xml, args->flags) == -1) {
+        virDomainFree(dom);
+        remoteDispatchConnError(rerr, conn);
+        return -1;
+    }
+    virDomainFree(dom);
+    return 0;
+}
+
+static int
 remoteDispatchDomainCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
                             struct qemud_client *client ATTRIBUTE_UNUSED,
                             virConnectPtr conn,
diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
index 68016aa..21217f3 100644
--- a/daemon/remote_dispatch_args.h
+++ b/daemon/remote_dispatch_args.h
@@ -142,3 +142,4 @@
     remote_domain_abort_job_args val_remote_domain_abort_job_args;
     remote_storage_vol_wipe_args val_remote_storage_vol_wipe_args;
     remote_domain_migrate_set_max_downtime_args val_remote_domain_migrate_set_max_downtime_args;
+    remote_domain_update_device_flags_args val_remote_domain_update_device_flags_args;
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
index 13e78ce..2c9cc83 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -490,6 +490,14 @@ static int remoteDispatchDomainUndefine(
     remote_error *err,
     remote_domain_undefine_args *args,
     void *ret);
+static int remoteDispatchDomainUpdateDeviceFlags(
+    struct qemud_server *server,
+    struct qemud_client *client,
+    virConnectPtr conn,
+    remote_message_header *hdr,
+    remote_error *err,
+    remote_domain_update_device_flags_args *args,
+    void *ret);
 static int remoteDispatchDomainXmlFromNative(
     struct qemud_server *server,
     struct qemud_client *client,
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index b0d0d1e..ebd9b8b 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -837,3 +837,8 @@
     .args_filter = (xdrproc_t) xdr_remote_domain_migrate_set_max_downtime_args,
     .ret_filter = (xdrproc_t) xdr_void,
 },
+{   /* DomainUpdateDeviceFlags => 167 */
+    .fn = (dispatch_fn) remoteDispatchDomainUpdateDeviceFlags,
+    .args_filter = (xdrproc_t) xdr_remote_domain_update_device_flags_args,
+    .ret_filter = (xdrproc_t) xdr_void,
+},
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 2088bed..024a24d 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -3158,6 +3158,32 @@ done:
 }
 
 static int
+remoteDomainUpdateDeviceFlags (virDomainPtr domain, const char *xml,
+                               unsigned int flags)
+{
+    int rv = -1;
+    remote_domain_update_device_flags_args args;
+    struct private_data *priv = domain->conn->privateData;
+
+    remoteDriverLock(priv);
+
+    make_nonnull_domain (&args.dom, domain);
+    args.xml = (char *) xml;
+    args.flags = flags;
+
+    if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS,
+              (xdrproc_t) xdr_remote_domain_update_device_flags_args, (char *) &args,
+              (xdrproc_t) xdr_void, (char *) NULL) == -1)
+        goto done;
+
+    rv = 0;
+
+done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
+static int
 remoteDomainGetAutostart (virDomainPtr domain, int *autostart)
 {
     int rv = -1;
@@ -9157,7 +9183,7 @@ static virDriver remote_driver = {
     remoteDomainAttachDeviceFlags, /* domainAttachDeviceFlags */
     remoteDomainDetachDevice, /* domainDetachDevice */
     remoteDomainDetachDeviceFlags, /* domainDetachDeviceFlags */
-    NULL, /* domainUpdateDeviceFlags */
+    remoteDomainUpdateDeviceFlags, /* domainUpdateDeviceFlags */
     remoteDomainGetAutostart, /* domainGetAutostart */
     remoteDomainSetAutostart, /* domainSetAutostart */
     remoteDomainGetSchedulerType, /* domainGetSchedulerType */
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
index 3e5c1c7..3950049 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -1319,6 +1319,19 @@ xdr_remote_domain_detach_device_flags_args (XDR *xdrs, remote_domain_detach_devi
 }
 
 bool_t
+xdr_remote_domain_update_device_flags_args (XDR *xdrs, remote_domain_update_device_flags_args *objp)
+{
+
+         if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+                 return FALSE;
+         if (!xdr_remote_nonnull_string (xdrs, &objp->xml))
+                 return FALSE;
+         if (!xdr_u_int (xdrs, &objp->flags))
+                 return FALSE;
+        return TRUE;
+}
+
+bool_t
 xdr_remote_domain_get_autostart_args (XDR *xdrs, remote_domain_get_autostart_args *objp)
 {
 
diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
index 43a3dc3..cd58c47 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -739,6 +739,13 @@ struct remote_domain_detach_device_flags_args {
 };
 typedef struct remote_domain_detach_device_flags_args remote_domain_detach_device_flags_args;
 
+struct remote_domain_update_device_flags_args {
+        remote_nonnull_domain dom;
+        remote_nonnull_string xml;
+        u_int flags;
+};
+typedef struct remote_domain_update_device_flags_args remote_domain_update_device_flags_args;
+
 struct remote_domain_get_autostart_args {
         remote_nonnull_domain dom;
 };
@@ -1887,6 +1894,7 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_ABORT_JOB = 164,
         REMOTE_PROC_STORAGE_VOL_WIPE = 165,
         REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME = 166,
+        REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS = 167,
 };
 typedef enum remote_procedure remote_procedure;
 
@@ -2028,6 +2036,7 @@ extern  bool_t xdr_remote_domain_attach_device_args (XDR *, remote_domain_attach
 extern  bool_t xdr_remote_domain_attach_device_flags_args (XDR *, remote_domain_attach_device_flags_args*);
 extern  bool_t xdr_remote_domain_detach_device_args (XDR *, remote_domain_detach_device_args*);
 extern  bool_t xdr_remote_domain_detach_device_flags_args (XDR *, remote_domain_detach_device_flags_args*);
+extern  bool_t xdr_remote_domain_update_device_flags_args (XDR *, remote_domain_update_device_flags_args*);
 extern  bool_t xdr_remote_domain_get_autostart_args (XDR *, remote_domain_get_autostart_args*);
 extern  bool_t xdr_remote_domain_get_autostart_ret (XDR *, remote_domain_get_autostart_ret*);
 extern  bool_t xdr_remote_domain_set_autostart_args (XDR *, remote_domain_set_autostart_args*);
@@ -2313,6 +2322,7 @@ extern bool_t xdr_remote_domain_attach_device_args ();
 extern bool_t xdr_remote_domain_attach_device_flags_args ();
 extern bool_t xdr_remote_domain_detach_device_args ();
 extern bool_t xdr_remote_domain_detach_device_flags_args ();
+extern bool_t xdr_remote_domain_update_device_flags_args ();
 extern bool_t xdr_remote_domain_get_autostart_args ();
 extern bool_t xdr_remote_domain_get_autostart_ret ();
 extern bool_t xdr_remote_domain_set_autostart_args ();
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 1633908..def6c9e 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -730,6 +730,12 @@ struct remote_domain_detach_device_flags_args {
     unsigned int flags;
 };
 
+struct remote_domain_update_device_flags_args {
+    remote_nonnull_domain dom;
+    remote_nonnull_string xml;
+    unsigned int flags;
+};
+
 struct remote_domain_get_autostart_args {
     remote_nonnull_domain dom;
 };
@@ -1717,7 +1723,8 @@ enum remote_procedure {
     REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163,
     REMOTE_PROC_DOMAIN_ABORT_JOB = 164,
     REMOTE_PROC_STORAGE_VOL_WIPE = 165,
-    REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME = 166
+    REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME = 166,
+    REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS = 167
 
     /*
      * Notice how the entries are grouped in sets of 10 ?
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]