This patch implements the remote protocol to address the new API. Signed-off-by: Taku Izumi <izumi.taku@xxxxxxxxxxxxxx> --- 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 | 29 ++++++++++++++++++++++++++++- src/remote/remote_protocol.c | 14 ++++++++++++++ src/remote/remote_protocol.h | 10 ++++++++++ src/remote/remote_protocol.x | 9 ++++++++- src/remote_protocol-structs | 5 +++++ 9 files changed, 105 insertions(+), 2 deletions(-) Index: libvirt-git/daemon/remote.c =================================================================== --- libvirt-git.orig/daemon/remote.c +++ libvirt-git/daemon/remote.c @@ -2384,6 +2384,32 @@ remoteDispatchDomainSetMemory (struct qe } 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, struct qemud_client *client Index: libvirt-git/daemon/remote_dispatch_args.h =================================================================== --- libvirt-git.orig/daemon/remote_dispatch_args.h +++ libvirt-git/daemon/remote_dispatch_args.h @@ -27,6 +27,7 @@ remote_domain_set_autostart_args val_remote_domain_set_autostart_args; remote_domain_set_max_memory_args val_remote_domain_set_max_memory_args; remote_domain_set_memory_args val_remote_domain_set_memory_args; + remote_domain_set_memory_flags_args val_remote_domain_set_memory_flags_args; remote_domain_set_vcpus_args val_remote_domain_set_vcpus_args; remote_domain_shutdown_args val_remote_domain_shutdown_args; remote_domain_suspend_args val_remote_domain_suspend_args; Index: libvirt-git/daemon/remote_dispatch_prototypes.h =================================================================== --- libvirt-git.orig/daemon/remote_dispatch_prototypes.h +++ libvirt-git/daemon/remote_dispatch_prototypes.h @@ -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: libvirt-git/daemon/remote_dispatch_table.h =================================================================== --- libvirt-git.orig/daemon/remote_dispatch_table.h +++ libvirt-git/daemon/remote_dispatch_table.h @@ -1022,3 +1022,8 @@ .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: libvirt-git/src/remote/remote_driver.c =================================================================== --- libvirt-git.orig/src/remote/remote_driver.c +++ libvirt-git/src/remote/remote_driver.c @@ -2445,6 +2445,33 @@ done: } 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, int nparams, @@ -10868,7 +10895,7 @@ static virDriver remote_driver = { remoteDomainGetMaxMemory, /* domainGetMaxMemory */ remoteDomainSetMaxMemory, /* domainSetMaxMemory */ remoteDomainSetMemory, /* domainSetMemory */ - NULL, /* domainSetMemoryFlags */ + remoteDomainSetMemoryFlags, /* domainSetMemoryFlags */ remoteDomainGetInfo, /* domainGetInfo */ remoteDomainSave, /* domainSave */ remoteDomainRestore, /* domainRestore */ Index: libvirt-git/src/remote/remote_protocol.c =================================================================== --- libvirt-git.orig/src/remote/remote_protocol.c +++ libvirt-git/src/remote/remote_protocol.c @@ -1070,6 +1070,20 @@ xdr_remote_domain_set_memory_args (XDR * } 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: libvirt-git/src/remote/remote_protocol.h =================================================================== --- libvirt-git.orig/src/remote/remote_protocol.h +++ libvirt-git/src/remote/remote_protocol.h @@ -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 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_ 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: libvirt-git/src/remote/remote_protocol.x =================================================================== --- libvirt-git.orig/src/remote/remote_protocol.x +++ libvirt-git/src/remote/remote_protocol.x @@ -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: libvirt-git/src/remote_protocol-structs =================================================================== --- libvirt-git.orig/src/remote_protocol-structs +++ libvirt-git/src/remote_protocol-structs @@ -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; }; -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list