]> xenbits.xensource.com Git - libvirt.git/commitdiff
setmem: implement the remote protocol to address the new API
authorTaku Izumi <izumi.taku@jp.fujitsu.com>
Wed, 2 Mar 2011 08:13:24 +0000 (17:13 +0900)
committerEric Blake <eblake@redhat.com>
Thu, 10 Mar 2011 22:02:58 +0000 (15:02 -0700)
This patch implements the remote protocol to address the new API.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
daemon/remote.c
daemon/remote_dispatch_args.h
daemon/remote_dispatch_prototypes.h
daemon/remote_dispatch_table.h
src/remote/remote_driver.c
src/remote/remote_protocol.c
src/remote/remote_protocol.h
src/remote/remote_protocol.x
src/remote_protocol-structs

index c5509ad4bb7f1294ecc34a60df6c502c88925cd1..22a314845c6d9ae45a44816b292989af1c281b71 100644 (file)
@@ -2383,6 +2383,32 @@ remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
     return 0;
 }
 
+static int
+remoteDispatchDomainSetMemoryFlags (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_set_memory_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 (virDomainSetMemoryFlags (dom, args->memory, args->flags) == -1) {
+        virDomainFree(dom);
+        remoteDispatchConnError(rerr, conn);
+        return -1;
+    }
+   virDomainFree(dom);
+   return 0;
+}
+
 static int
 remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
                                         ATTRIBUTE_UNUSED,
index 57962d10db0315a97b73cf8b93ca3887360a5039..013c30a80467d514f06fac691b16510456d525de 100644 (file)
     remote_domain_open_console_args val_remote_domain_open_console_args;
     remote_domain_is_updated_args val_remote_domain_is_updated_args;
     remote_get_sysinfo_args val_remote_get_sysinfo_args;
+    remote_domain_set_memory_flags_args val_remote_domain_set_memory_flags_args;
index e59701ac7d460d6e1ac1bb2a1a211569f258f5a7..4e28451f2fb89ab4b30508e873a7041ec5b5036e 100644 (file)
@@ -554,6 +554,14 @@ static int remoteDispatchDomainSetMemory(
     remote_error *err,
     remote_domain_set_memory_args *args,
     void *ret);
+static int remoteDispatchDomainSetMemoryFlags(
+    struct qemud_server *server,
+    struct qemud_client *client,
+    virConnectPtr conn,
+    remote_message_header *hdr,
+    remote_error *err,
+    remote_domain_set_memory_flags_args *args,
+    void *ret);
 static int remoteDispatchDomainSetMemoryParameters(
     struct qemud_server *server,
     struct qemud_client *client,
index 5d27390729a49230548ece091fef43feddf2211f..64341abed25e0472de0f95ce6ce1b76244bad080 100644 (file)
     .args_filter = (xdrproc_t) xdr_remote_get_sysinfo_args,
     .ret_filter = (xdrproc_t) xdr_remote_get_sysinfo_ret,
 },
+{   /* DomainSetMemoryFlags => 204 */
+    .fn = (dispatch_fn) remoteDispatchDomainSetMemoryFlags,
+    .args_filter = (xdrproc_t) xdr_remote_domain_set_memory_flags_args,
+    .ret_filter = (xdrproc_t) xdr_void,
+},
index e2e00eb1b98e62b50ac290aa8f63b3b6cde9f1e0..796e06d79ff6b05e56b918f6d39b661ca1150c13 100644 (file)
@@ -2450,6 +2450,33 @@ done:
     return rv;
 }
 
+static int
+remoteDomainSetMemoryFlags (virDomainPtr domain, unsigned long memory, unsigned int flags)
+{
+    int rv = -1;
+    remote_domain_set_memory_flags_args args;
+    struct private_data *priv = domain->conn->privateData;
+
+    remoteDriverLock(priv);
+
+    make_nonnull_domain (&args.dom, domain);
+    args.memory = memory;
+    args.flags = flags;
+
+    if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS,
+              (xdrproc_t) xdr_remote_domain_set_memory_flags_args,
+              (char *) &args,
+              (xdrproc_t) xdr_void,
+              (char *) NULL) == -1)
+        goto done;
+
+    rv = 0;
+
+done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
 static int
 remoteDomainSetMemoryParameters (virDomainPtr domain,
                                  virMemoryParameterPtr params,
@@ -10876,7 +10903,7 @@ static virDriver remote_driver = {
     remoteDomainGetMaxMemory, /* domainGetMaxMemory */
     remoteDomainSetMaxMemory, /* domainSetMaxMemory */
     remoteDomainSetMemory, /* domainSetMemory */
-    NULL, /* domainSetMemoryFlags */
+    remoteDomainSetMemoryFlags, /* domainSetMemoryFlags */
     remoteDomainGetInfo, /* domainGetInfo */
     remoteDomainSave, /* domainSave */
     remoteDomainRestore, /* domainRestore */
index bae92ca2c4ad63ab11e5dfcc588936481a1cba40..5cc85d03ed7c61edb31d0c44b1bb034cfe801e43 100644 (file)
@@ -1069,6 +1069,19 @@ xdr_remote_domain_set_memory_args (XDR *xdrs, remote_domain_set_memory_args *obj
         return TRUE;
 }
 
+bool_t
+xdr_remote_domain_set_memory_flags_args (XDR *xdrs, remote_domain_set_memory_flags_args *objp)
+{
+
+         if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+                 return FALSE;
+         if (!xdr_uint64_t (xdrs, &objp->memory))
+                 return FALSE;
+         if (!xdr_u_int (xdrs, &objp->flags))
+                 return FALSE;
+        return TRUE;
+}
+
 bool_t
 xdr_remote_domain_get_info_args (XDR *xdrs, remote_domain_get_info_args *objp)
 {
index 46d526a6a220878c3228f0778be9578afbc51c50..6ff3a4a9eff2bf0722f10d14bec67304990e1d46 100644 (file)
@@ -581,6 +581,13 @@ struct remote_domain_set_memory_args {
 };
 typedef struct remote_domain_set_memory_args remote_domain_set_memory_args;
 
+struct remote_domain_set_memory_flags_args {
+        remote_nonnull_domain dom;
+        uint64_t memory;
+        u_int flags;
+};
+typedef struct remote_domain_set_memory_flags_args remote_domain_set_memory_flags_args;
+
 struct remote_domain_get_info_args {
         remote_nonnull_domain dom;
 };
@@ -2331,6 +2338,7 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201,
         REMOTE_PROC_DOMAIN_IS_UPDATED = 202,
         REMOTE_PROC_GET_SYSINFO = 203,
+        REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS = 204,
 };
 typedef enum remote_procedure remote_procedure;
 
@@ -2448,6 +2456,7 @@ extern  bool_t xdr_remote_domain_get_max_memory_args (XDR *, remote_domain_get_m
 extern  bool_t xdr_remote_domain_get_max_memory_ret (XDR *, remote_domain_get_max_memory_ret*);
 extern  bool_t xdr_remote_domain_set_max_memory_args (XDR *, remote_domain_set_max_memory_args*);
 extern  bool_t xdr_remote_domain_set_memory_args (XDR *, remote_domain_set_memory_args*);
+extern  bool_t xdr_remote_domain_set_memory_flags_args (XDR *, remote_domain_set_memory_flags_args*);
 extern  bool_t xdr_remote_domain_get_info_args (XDR *, remote_domain_get_info_args*);
 extern  bool_t xdr_remote_domain_get_info_ret (XDR *, remote_domain_get_info_ret*);
 extern  bool_t xdr_remote_domain_save_args (XDR *, remote_domain_save_args*);
@@ -2796,6 +2805,7 @@ extern bool_t xdr_remote_domain_get_max_memory_args ();
 extern bool_t xdr_remote_domain_get_max_memory_ret ();
 extern bool_t xdr_remote_domain_set_max_memory_args ();
 extern bool_t xdr_remote_domain_set_memory_args ();
+extern bool_t xdr_remote_domain_set_memory_flags_args ();
 extern bool_t xdr_remote_domain_get_info_args ();
 extern bool_t xdr_remote_domain_get_info_ret ();
 extern bool_t xdr_remote_domain_save_args ();
index e77aca124380a4f00249b1538e5ca7b2ae96cd70..0686266aa43a15815dae15ef114a32574c97de66 100644 (file)
@@ -641,6 +641,12 @@ struct remote_domain_set_memory_args {
     unsigned hyper memory;
 };
 
+struct remote_domain_set_memory_flags_args {
+    remote_nonnull_domain dom;
+    unsigned hyper memory;
+    unsigned int flags;
+};
+
 struct remote_domain_get_info_args {
     remote_nonnull_domain dom;
 };
@@ -2103,7 +2109,8 @@ enum remote_procedure {
 
     REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201,
     REMOTE_PROC_DOMAIN_IS_UPDATED = 202,
-    REMOTE_PROC_GET_SYSINFO = 203
+    REMOTE_PROC_GET_SYSINFO = 203,
+    REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS = 204
 
     /*
      * Notice how the entries are grouped in sets of 10 ?
index 6a7f03d74612e36716d5cddb003be97e27e60dcc..6e131c8fc3ad50faf87c49c6728822fde207b520 100644 (file)
@@ -340,6 +340,11 @@ struct remote_domain_set_memory_args {
        remote_nonnull_domain      dom;
        uint64_t                   memory;
 };
+struct remote_domain_set_memory_flags_args {
+       remote_nonnull_domain      dom;
+       uint64_t                   memory;
+       u_int                      flags;
+};
 struct remote_domain_get_info_args {
        remote_nonnull_domain      dom;
 };