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

[libvirt] [PATCH 2/3] Wire up virDomainMigrateSetSpeed for the remote RPC driver



* src/remote/remote_protocol.x: Define wire protocol
* daemon/remote.c, src/remote/remote_driver.c: Add new
  functions for virDomainMigrateSetSpeed API
* src/remote/remote_protocol.c, src/remote/remote_protocol.h,
  daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_table.h: Re-generate files
---
 daemon/remote.c                     |   28 ++++++++++++++++++++++++++++
 daemon/remote_dispatch_args.h       |    1 +
 daemon/remote_dispatch_prototypes.h |    8 ++++++++
 daemon/remote_dispatch_table.h      |    5 +++++
 src/remote/remote_driver.c          |   31 ++++++++++++++++++++++++++++++-
 src/remote/remote_protocol.c        |   13 +++++++++++++
 src/remote/remote_protocol.h        |   10 ++++++++++
 src/remote/remote_protocol.x        |    9 ++++++++-
 8 files changed, 103 insertions(+), 2 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index f410982..a8fef4d 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -6563,6 +6563,34 @@ remoteDispatchDomainMigrateSetMaxDowntime(struct qemud_server *server ATTRIBUTE_
 }
 
 static int
+remoteDispatchDomainMigrateSetMaxSpeed(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_migrate_set_max_speed_args *args,
+                                       void *ret ATTRIBUTE_UNUSED)
+{
+    virDomainPtr dom;
+
+    dom = get_nonnull_domain(conn, args->dom);
+    if (dom == NULL) {
+        remoteDispatchConnError(rerr, conn);
+        return -1;
+    }
+
+    if (virDomainMigrateSetMaxSpeed(dom, args->bandwidth, args->flags) == -1) {
+        virDomainFree(dom);
+        remoteDispatchConnError(rerr, conn);
+        return -1;
+    }
+
+    virDomainFree(dom);
+
+    return 0;
+}
+
+static int
 remoteDispatchDomainSnapshotCreateXml (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 b32ae1f..15fa1a0 100644
--- a/daemon/remote_dispatch_args.h
+++ b/daemon/remote_dispatch_args.h
@@ -175,3 +175,4 @@
     remote_domain_set_memory_flags_args val_remote_domain_set_memory_flags_args;
     remote_domain_set_blkio_parameters_args val_remote_domain_set_blkio_parameters_args;
     remote_domain_get_blkio_parameters_args val_remote_domain_get_blkio_parameters_args;
+    remote_domain_migrate_set_max_speed_args val_remote_domain_migrate_set_max_speed_args;
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
index 4db6c76..3fcf87c 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -482,6 +482,14 @@ static int remoteDispatchDomainMigrateSetMaxDowntime(
     remote_error *err,
     remote_domain_migrate_set_max_downtime_args *args,
     void *ret);
+static int remoteDispatchDomainMigrateSetMaxSpeed(
+    struct qemud_server *server,
+    struct qemud_client *client,
+    virConnectPtr conn,
+    remote_message_header *hdr,
+    remote_error *err,
+    remote_domain_migrate_set_max_speed_args *args,
+    void *ret);
 static int remoteDispatchDomainOpenConsole(
     struct qemud_server *server,
     struct qemud_client *client,
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index c50d038..c5f6653 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -1037,3 +1037,8 @@
     .args_filter = (xdrproc_t) xdr_remote_domain_get_blkio_parameters_args,
     .ret_filter = (xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret,
 },
+{   /* DomainMigrateSetMaxSpeed => 207 */
+    .fn = (dispatch_fn) remoteDispatchDomainMigrateSetMaxSpeed,
+    .args_filter = (xdrproc_t) xdr_remote_domain_migrate_set_max_speed_args,
+    .ret_filter = (xdrproc_t) xdr_void,
+},
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 8741a87..19df3ff 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -9214,6 +9214,35 @@ done:
     return rv;
 }
 
+static int
+remoteDomainMigrateSetMaxSpeed(virDomainPtr domain,
+                               unsigned long bandwidth,
+                               unsigned int flags)
+{
+    struct private_data *priv = domain->conn->privateData;
+    remote_domain_migrate_set_max_speed_args args;
+    int rv = -1;
+
+    remoteDriverLock(priv);
+
+    make_nonnull_domain(&args.dom, domain);
+    args.bandwidth = bandwidth;
+    args.flags = flags;
+
+    if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED,
+             (xdrproc_t) xdr_remote_domain_migrate_set_max_speed_args,
+             (char *) &args,
+             (xdrproc_t) xdr_void,
+             (char *) NULL) == -1)
+        goto done;
+
+    rv = 0;
+
+done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
 static virDomainSnapshotPtr
 remoteDomainSnapshotCreateXML(virDomainPtr domain,
                               const char *xmlDesc,
@@ -11210,7 +11239,7 @@ static virDriver remote_driver = {
     remoteDomainGetJobInfo, /* domainGetJobInfo */
     remoteDomainAbortJob, /* domainFinishJob */
     remoteDomainMigrateSetMaxDowntime, /* domainMigrateSetMaxDowntime */
-    NULL, /* domainMigrateSetMaxSpeed */
+    remoteDomainMigrateSetMaxSpeed, /* domainMigrateSetMaxSpeed */
     remoteDomainEventRegisterAny, /* domainEventRegisterAny */
     remoteDomainEventDeregisterAny, /* domainEventDeregisterAny */
     remoteDomainManagedSave, /* domainManagedSave */
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
index ea2bdf7..7ecea9d 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -3508,6 +3508,19 @@ xdr_remote_domain_migrate_set_max_downtime_args (XDR *xdrs, remote_domain_migrat
 }
 
 bool_t
+xdr_remote_domain_migrate_set_max_speed_args (XDR *xdrs, remote_domain_migrate_set_max_speed_args *objp)
+{
+
+         if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+                 return FALSE;
+         if (!xdr_uint64_t (xdrs, &objp->bandwidth))
+                 return FALSE;
+         if (!xdr_u_int (xdrs, &objp->flags))
+                 return FALSE;
+        return TRUE;
+}
+
+bool_t
 xdr_remote_domain_events_register_any_args (XDR *xdrs, remote_domain_events_register_any_args *objp)
 {
 
diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
index a55f7c4..87de0da 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -1982,6 +1982,13 @@ struct remote_domain_migrate_set_max_downtime_args {
 };
 typedef struct remote_domain_migrate_set_max_downtime_args remote_domain_migrate_set_max_downtime_args;
 
+struct remote_domain_migrate_set_max_speed_args {
+        remote_nonnull_domain dom;
+        uint64_t bandwidth;
+        u_int flags;
+};
+typedef struct remote_domain_migrate_set_max_speed_args remote_domain_migrate_set_max_speed_args;
+
 struct remote_domain_events_register_any_args {
         int eventID;
 };
@@ -2387,6 +2394,7 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS = 204,
         REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS = 205,
         REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206,
+        REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207,
 };
 typedef enum remote_procedure remote_procedure;
 
@@ -2736,6 +2744,7 @@ extern  bool_t xdr_remote_domain_get_job_info_args (XDR *, remote_domain_get_job
 extern  bool_t xdr_remote_domain_get_job_info_ret (XDR *, remote_domain_get_job_info_ret*);
 extern  bool_t xdr_remote_domain_abort_job_args (XDR *, remote_domain_abort_job_args*);
 extern  bool_t xdr_remote_domain_migrate_set_max_downtime_args (XDR *, remote_domain_migrate_set_max_downtime_args*);
+extern  bool_t xdr_remote_domain_migrate_set_max_speed_args (XDR *, remote_domain_migrate_set_max_speed_args*);
 extern  bool_t xdr_remote_domain_events_register_any_args (XDR *, remote_domain_events_register_any_args*);
 extern  bool_t xdr_remote_domain_events_deregister_any_args (XDR *, remote_domain_events_deregister_any_args*);
 extern  bool_t xdr_remote_domain_event_reboot_msg (XDR *, remote_domain_event_reboot_msg*);
@@ -3090,6 +3099,7 @@ extern bool_t xdr_remote_domain_get_job_info_args ();
 extern bool_t xdr_remote_domain_get_job_info_ret ();
 extern bool_t xdr_remote_domain_abort_job_args ();
 extern bool_t xdr_remote_domain_migrate_set_max_downtime_args ();
+extern bool_t xdr_remote_domain_migrate_set_max_speed_args ();
 extern bool_t xdr_remote_domain_events_register_any_args ();
 extern bool_t xdr_remote_domain_events_deregister_any_args ();
 extern bool_t xdr_remote_domain_event_reboot_msg ();
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index aa710a4..7310689 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -1760,6 +1760,12 @@ struct remote_domain_migrate_set_max_downtime_args {
     unsigned flags;
 };
 
+struct remote_domain_migrate_set_max_speed_args {
+    remote_nonnull_domain dom;
+    unsigned hyper bandwidth;
+    unsigned flags;
+};
+
 struct remote_domain_events_register_any_args {
     int eventID;
 };
@@ -2152,7 +2158,8 @@ enum remote_procedure {
     REMOTE_PROC_GET_SYSINFO = 203,
     REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS = 204,
     REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS = 205,
-    REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206
+    REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206,
+    REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207
 
     /*
      * Notice how the entries are grouped in sets of 10 ?
-- 
1.7.4


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