[libvirt] [PATCH v2 2/5] Wire protocol and dispatcher for virDomainMigrateSetMaxDowntime

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

 



---
 daemon/remote.c                     |   29 ++++++++++
 daemon/remote_dispatch_args.h       |    1 +
 daemon/remote_dispatch_prototypes.h |    8 +++
 daemon/remote_dispatch_table.h      |    5 ++
 src/remote/remote_protocol.c        |   13 +++++
 src/remote/remote_protocol.h        |   98 +++++++++++++++++++----------------
 src/remote/remote_protocol.x        |   10 +++-
 7 files changed, 119 insertions(+), 45 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 7c4339f..9ea19c1 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -5463,6 +5463,35 @@ remoteDispatchDomainAbortJob (struct qemud_server *server ATTRIBUTE_UNUSED,
 }
 
 
+static int
+remoteDispatchDomainMigrateSetMaxDowntime(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_downtime_args *args,
+                                          void *ret ATTRIBUTE_UNUSED)
+{
+    virDomainPtr dom;
+
+    dom = get_nonnull_domain(conn, args->dom);
+    if (dom == NULL) {
+        remoteDispatchConnError(rerr, conn);
+        return -1;
+    }
+
+    if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) == -1) {
+        virDomainFree(dom);
+        remoteDispatchConnError(rerr, conn);
+        return -1;
+    }
+
+    virDomainFree(dom);
+
+    return 0;
+}
+
+
 /*----- Helpers. -----*/
 
 /* get_nonnull_domain and get_nonnull_network turn an on-wire
diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
index f97155b..fa4a1d0 100644
--- a/daemon/remote_dispatch_args.h
+++ b/daemon/remote_dispatch_args.h
@@ -140,3 +140,4 @@
     remote_cpu_baseline_args val_remote_cpu_baseline_args;
     remote_domain_get_job_info_args val_remote_domain_get_job_info_args;
     remote_domain_abort_job_args val_remote_domain_abort_job_args;
+    remote_domain_migrate_set_max_downtime_args val_remote_domain_migrate_set_max_downtime_args;
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
index b81c8c3..c94c536 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -378,6 +378,14 @@ static int remoteDispatchDomainMigratePrepareTunnel(
     remote_error *err,
     remote_domain_migrate_prepare_tunnel_args *args,
     void *ret);
+static int remoteDispatchDomainMigrateSetMaxDowntime(
+    struct qemud_server *server,
+    struct qemud_client *client,
+    virConnectPtr conn,
+    remote_message_header *hdr,
+    remote_error *err,
+    remote_domain_migrate_set_max_downtime_args *args,
+    void *ret);
 static int remoteDispatchDomainPinVcpu(
     struct qemud_server *server,
     struct qemud_client *client,
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index 5ad6bff..ebba5ab 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -827,3 +827,8 @@
     .args_filter = (xdrproc_t) xdr_remote_domain_abort_job_args,
     .ret_filter = (xdrproc_t) xdr_void,
 },
+{   /* DomainMigrateSetMaxDowntime => 165 */
+    .fn = (dispatch_fn) remoteDispatchDomainMigrateSetMaxDowntime,
+    .args_filter = (xdrproc_t) xdr_remote_domain_migrate_set_max_downtime_args,
+    .ret_filter = (xdrproc_t) xdr_void,
+},
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
index 701acab..490ad43 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -3009,6 +3009,19 @@ xdr_remote_domain_abort_job_args (XDR *xdrs, remote_domain_abort_job_args *objp)
 }
 
 bool_t
+xdr_remote_domain_migrate_set_max_downtime_args (XDR *xdrs, remote_domain_migrate_set_max_downtime_args *objp)
+{
+
+         if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+                 return FALSE;
+         if (!xdr_uint64_t (xdrs, &objp->downtime))
+                 return FALSE;
+         if (!xdr_u_int (xdrs, &objp->flags))
+                 return FALSE;
+        return TRUE;
+}
+
+bool_t
 xdr_remote_procedure (XDR *xdrs, remote_procedure *objp)
 {
 
diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
index f76e6e5..34d49fa 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -4,51 +4,51 @@
  */
 
 #ifndef _RP_H_RPCGEN
-# define _RP_H_RPCGEN
+#define _RP_H_RPCGEN
 
-# include <rpc/rpc.h>
+#include <rpc/rpc.h>
 
 
-# ifdef __cplusplus
+#ifdef __cplusplus
 extern "C" {
-# endif
+#endif
 
-# include "internal.h"
-# include <arpa/inet.h>
-# define REMOTE_MESSAGE_MAX 262144
-# define REMOTE_MESSAGE_HEADER_MAX 24
-# define REMOTE_MESSAGE_PAYLOAD_MAX 262120
-# define REMOTE_STRING_MAX 65536
+#include "internal.h"
+#include <arpa/inet.h>
+#define REMOTE_MESSAGE_MAX 262144
+#define REMOTE_MESSAGE_HEADER_MAX 24
+#define REMOTE_MESSAGE_PAYLOAD_MAX 262120
+#define REMOTE_STRING_MAX 65536
 
 typedef char *remote_nonnull_string;
 
 typedef remote_nonnull_string *remote_string;
-# define REMOTE_DOMAIN_ID_LIST_MAX 16384
-# define REMOTE_DOMAIN_NAME_LIST_MAX 1024
-# define REMOTE_CPUMAP_MAX 256
-# define REMOTE_VCPUINFO_MAX 2048
-# define REMOTE_CPUMAPS_MAX 16384
-# define REMOTE_MIGRATE_COOKIE_MAX 256
-# define REMOTE_NETWORK_NAME_LIST_MAX 256
-# define REMOTE_INTERFACE_NAME_LIST_MAX 256
-# define REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX 256
-# define REMOTE_STORAGE_POOL_NAME_LIST_MAX 256
-# define REMOTE_STORAGE_VOL_NAME_LIST_MAX 1024
-# define REMOTE_NODE_DEVICE_NAME_LIST_MAX 16384
-# define REMOTE_NODE_DEVICE_CAPS_LIST_MAX 16384
-# define REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX 16
-# define REMOTE_NODE_MAX_CELLS 1024
-# define REMOTE_AUTH_SASL_DATA_MAX 65536
-# define REMOTE_AUTH_TYPE_LIST_MAX 20
-# define REMOTE_DOMAIN_MEMORY_STATS_MAX 1024
-# define REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX 65536
-# define REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX 65536
-# define REMOTE_SECURITY_MODEL_MAX VIR_SECURITY_MODEL_BUFLEN
-# define REMOTE_SECURITY_LABEL_MAX VIR_SECURITY_LABEL_BUFLEN
-# define REMOTE_SECURITY_DOI_MAX VIR_SECURITY_DOI_BUFLEN
-# define REMOTE_SECRET_VALUE_MAX 65536
-# define REMOTE_SECRET_UUID_LIST_MAX 16384
-# define REMOTE_CPU_BASELINE_MAX 256
+#define REMOTE_DOMAIN_ID_LIST_MAX 16384
+#define REMOTE_DOMAIN_NAME_LIST_MAX 1024
+#define REMOTE_CPUMAP_MAX 256
+#define REMOTE_VCPUINFO_MAX 2048
+#define REMOTE_CPUMAPS_MAX 16384
+#define REMOTE_MIGRATE_COOKIE_MAX 256
+#define REMOTE_NETWORK_NAME_LIST_MAX 256
+#define REMOTE_INTERFACE_NAME_LIST_MAX 256
+#define REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX 256
+#define REMOTE_STORAGE_POOL_NAME_LIST_MAX 256
+#define REMOTE_STORAGE_VOL_NAME_LIST_MAX 1024
+#define REMOTE_NODE_DEVICE_NAME_LIST_MAX 16384
+#define REMOTE_NODE_DEVICE_CAPS_LIST_MAX 16384
+#define REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX 16
+#define REMOTE_NODE_MAX_CELLS 1024
+#define REMOTE_AUTH_SASL_DATA_MAX 65536
+#define REMOTE_AUTH_TYPE_LIST_MAX 20
+#define REMOTE_DOMAIN_MEMORY_STATS_MAX 1024
+#define REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX 65536
+#define REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX 65536
+#define REMOTE_SECURITY_MODEL_MAX VIR_SECURITY_MODEL_BUFLEN
+#define REMOTE_SECURITY_LABEL_MAX VIR_SECURITY_LABEL_BUFLEN
+#define REMOTE_SECURITY_DOI_MAX VIR_SECURITY_DOI_BUFLEN
+#define REMOTE_SECRET_VALUE_MAX 65536
+#define REMOTE_SECRET_UUID_LIST_MAX 16384
+#define REMOTE_CPU_BASELINE_MAX 256
 
 typedef char remote_uuid[VIR_UUID_BUFLEN];
 
@@ -1704,8 +1704,15 @@ struct remote_domain_abort_job_args {
         remote_nonnull_domain dom;
 };
 typedef struct remote_domain_abort_job_args remote_domain_abort_job_args;
-# define REMOTE_PROGRAM 0x20008086
-# define REMOTE_PROTOCOL_VERSION 1
+
+struct remote_domain_migrate_set_max_downtime_args {
+        remote_nonnull_domain dom;
+        uint64_t downtime;
+        u_int flags;
+};
+typedef struct remote_domain_migrate_set_max_downtime_args remote_domain_migrate_set_max_downtime_args;
+#define REMOTE_PROGRAM 0x20008086
+#define REMOTE_PROTOCOL_VERSION 1
 
 enum remote_procedure {
         REMOTE_PROC_OPEN = 1,
@@ -1872,6 +1879,7 @@ enum remote_procedure {
         REMOTE_PROC_CPU_BASELINE = 162,
         REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163,
         REMOTE_PROC_DOMAIN_ABORT_JOB = 164,
+        REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME = 165,
 };
 typedef enum remote_procedure remote_procedure;
 
@@ -1889,7 +1897,7 @@ enum remote_message_status {
         REMOTE_CONTINUE = 2,
 };
 typedef enum remote_message_status remote_message_status;
-# define REMOTE_MESSAGE_HEADER_XDR_LEN 4
+#define REMOTE_MESSAGE_HEADER_XDR_LEN 4
 
 struct remote_message_header {
         u_int prog;
@@ -1903,7 +1911,7 @@ typedef struct remote_message_header remote_message_header;
 
 /* the xdr functions */
 
-# if defined(__STDC__) || defined(__cplusplus)
+#if defined(__STDC__) || defined(__cplusplus)
 extern  bool_t xdr_remote_nonnull_string (XDR *, remote_nonnull_string*);
 extern  bool_t xdr_remote_string (XDR *, remote_string*);
 extern  bool_t xdr_remote_uuid (XDR *, remote_uuid);
@@ -2181,12 +2189,13 @@ extern  bool_t xdr_remote_cpu_baseline_ret (XDR *, remote_cpu_baseline_ret*);
 extern  bool_t xdr_remote_domain_get_job_info_args (XDR *, remote_domain_get_job_info_args*);
 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_procedure (XDR *, remote_procedure*);
 extern  bool_t xdr_remote_message_type (XDR *, remote_message_type*);
 extern  bool_t xdr_remote_message_status (XDR *, remote_message_status*);
 extern  bool_t xdr_remote_message_header (XDR *, remote_message_header*);
 
-# else /* K&R C */
+#else /* K&R C */
 extern bool_t xdr_remote_nonnull_string ();
 extern bool_t xdr_remote_string ();
 extern bool_t xdr_remote_uuid ();
@@ -2464,15 +2473,16 @@ extern bool_t xdr_remote_cpu_baseline_ret ();
 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_procedure ();
 extern bool_t xdr_remote_message_type ();
 extern bool_t xdr_remote_message_status ();
 extern bool_t xdr_remote_message_header ();
 
-# endif /* K&R C */
+#endif /* K&R C */
 
-# ifdef __cplusplus
+#ifdef __cplusplus
 }
-# endif
+#endif
 
 #endif /* !_RP_H_RPCGEN */
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 5e33da5..9f6521a 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -1517,6 +1517,13 @@ struct remote_domain_abort_job_args {
 };
 
 
+struct remote_domain_migrate_set_max_downtime_args {
+    remote_nonnull_domain dom;
+    unsigned hyper downtime;
+    unsigned flags;
+};
+
+
 /*----- Protocol. -----*/
 
 /* Define the program number, protocol version and procedure numbers here. */
@@ -1703,7 +1710,8 @@ enum remote_procedure {
     REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161,
     REMOTE_PROC_CPU_BASELINE = 162,
     REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163,
-    REMOTE_PROC_DOMAIN_ABORT_JOB = 164
+    REMOTE_PROC_DOMAIN_ABORT_JOB = 164,
+    REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME = 165
 
     /*
      * Notice how the entries are grouped in sets of 10 ?
-- 
1.7.0.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]