At 03/18/2011 10:46 AM, Taku Izumi Write: > > This patch implements the remote protocol to address the new > API (virDomainSetMaxMemoryFlags). > > 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 | 13 +++++++++++++ > src/remote/remote_protocol.h | 10 ++++++++++ > src/remote/remote_protocol.x | 9 ++++++++- > src/remote_protocol-structs | 5 +++++ > 9 files changed, 104 insertions(+), 2 deletions(-) > > Index: libvirt/daemon/remote.c > =================================================================== > --- libvirt.orig/daemon/remote.c > +++ libvirt/daemon/remote.c > @@ -2358,6 +2358,32 @@ remoteDispatchDomainSetMaxMemory (struct > } > > static int > +remoteDispatchDomainSetMaxMemoryFlags (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_max_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 (virDomainSetMaxMemoryFlags (dom, args->memory, args->flags) == -1) { > + virDomainFree(dom); > + remoteDispatchConnError(rerr, conn); > + return -1; > + } > + virDomainFree(dom); > + return 0; > +} > + > +static int > remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED, > struct qemud_client *client ATTRIBUTE_UNUSED, > virConnectPtr conn, > Index: libvirt/daemon/remote_dispatch_args.h > =================================================================== > --- libvirt.orig/daemon/remote_dispatch_args.h > +++ libvirt/daemon/remote_dispatch_args.h > @@ -26,6 +26,7 @@ > remote_domain_resume_args val_remote_domain_resume_args; > 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_max_memory_flags_args val_remote_domain_set_max_memory_flags_args; > remote_domain_set_memory_args val_remote_domain_set_memory_args; > remote_domain_set_vcpus_args val_remote_domain_set_vcpus_args; > remote_domain_shutdown_args val_remote_domain_shutdown_args; > Index: libvirt/daemon/remote_dispatch_prototypes.h > =================================================================== > --- libvirt.orig/daemon/remote_dispatch_prototypes.h > +++ libvirt/daemon/remote_dispatch_prototypes.h > @@ -562,6 +562,14 @@ static int remoteDispatchDomainSetMaxMem > remote_error *err, > remote_domain_set_max_memory_args *args, > void *ret); > +static int remoteDispatchDomainSetMaxMemoryFlags( > + struct qemud_server *server, > + struct qemud_client *client, > + virConnectPtr conn, > + remote_message_header *hdr, > + remote_error *err, > + remote_domain_set_max_memory_flags_args *args, > + void *ret); > static int remoteDispatchDomainSetMemory( > struct qemud_server *server, > struct qemud_client *client, > Index: libvirt/daemon/remote_dispatch_table.h > =================================================================== > --- libvirt.orig/daemon/remote_dispatch_table.h > +++ libvirt/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, > }, > +{ /* DomainSetMaxMemoryFlags => 207 */ > + .fn = (dispatch_fn) remoteDispatchDomainSetMaxMemoryFlags, > + .args_filter = (xdrproc_t) xdr_remote_domain_set_max_memory_flags_args, > + .ret_filter = (xdrproc_t) xdr_void, > +}, > Index: libvirt/src/remote/remote_driver.c > =================================================================== > --- libvirt.orig/src/remote/remote_driver.c > +++ libvirt/src/remote/remote_driver.c > @@ -2427,6 +2427,33 @@ done: > } > > static int > +remoteDomainSetMaxMemoryFlags (virDomainPtr domain, unsigned long memory, > + unsigned int flags) { > + int rv = -1; > + remote_domain_set_max_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_MAX_MEMORY_FLAGS, > + (xdrproc_t) xdr_remote_domain_set_max_memory_flags_args, > + (char *) &args, > + (xdrproc_t) xdr_void, > + (char *) NULL) == -1) > + goto done; > + > + rv = 0; > + > +done: > + remoteDriverUnlock(priv); > + return rv; > +} > + > +static int > remoteDomainSetMemory (virDomainPtr domain, unsigned long memory) > { > int rv = -1; > @@ -11076,7 +11103,7 @@ static virDriver remote_driver = { > remoteDomainGetOSType, /* domainGetOSType */ > remoteDomainGetMaxMemory, /* domainGetMaxMemory */ > remoteDomainSetMaxMemory, /* domainSetMaxMemory */ > - NULL, /* domainSetMaxMemoryFlags */ > + remoteDomainSetMaxMemoryFlags, /* domainSetMaxMemoryFlags */ > remoteDomainSetMemory, /* domainSetMemory */ > remoteDomainSetMemoryFlags, /* domainSetMemoryFlags */ > remoteDomainSetMemoryParameters, /* domainSetMemoryParameters */ > Index: libvirt/src/remote/remote_protocol.c > =================================================================== > --- libvirt.orig/src/remote/remote_protocol.c > +++ libvirt/src/remote/remote_protocol.c > @@ -1147,6 +1147,19 @@ xdr_remote_domain_set_max_memory_args (X > } > > bool_t > +xdr_remote_domain_set_max_memory_flags_args (XDR *xdrs, > + remote_domain_set_max_memory_flags_args > *objp) Please check the setting of your mail client. This patch is broken by your mail client. > +{ > + 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_set_memory_args (XDR *xdrs, remote_domain_set_memory_args *objp) > { > > Index: libvirt/src/remote/remote_protocol.h > =================================================================== > --- libvirt.orig/src/remote/remote_protocol.h > +++ libvirt/src/remote/remote_protocol.h > @@ -621,6 +621,13 @@ struct remote_domain_set_max_memory_args > }; > typedef struct remote_domain_set_max_memory_args remote_domain_set_max_memory_args; > > +struct remote_domain_set_max_memory_flags_args { > + remote_nonnull_domain dom; > + uint64_t memory; > + u_int flags; > +}; > +typedef struct remote_domain_set_max_memory_flags_args > remote_domain_set_max_memory_flags_args; The same as above > + > struct remote_domain_set_memory_args { > remote_nonnull_domain dom; > uint64_t memory; > @@ -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_SET_MAX_MEMORY_FLAGS = 207, > }; > typedef enum remote_procedure remote_procedure; > > @@ -2508,6 +2516,7 @@ extern bool_t xdr_remote_domain_get_os_ > extern bool_t xdr_remote_domain_get_max_memory_args (XDR *, > remote_domain_get_max_memory_args*); > 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_max_memory_flags_args (XDR *, > remote_domain_set_max_memory_flags_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*); > @@ -2862,6 +2871,7 @@ extern bool_t xdr_remote_domain_get_os_t > 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_max_memory_flags_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 (); > Index: libvirt/src/remote/remote_protocol.x > =================================================================== > --- libvirt.orig/src/remote/remote_protocol.x > +++ libvirt/src/remote/remote_protocol.x > @@ -676,6 +676,12 @@ struct remote_domain_set_max_memory_args > unsigned hyper memory; > }; > > +struct remote_domain_set_max_memory_flags_args { > + remote_nonnull_domain dom; > + unsigned hyper memory; > + unsigned int flags; > +}; > + > struct remote_domain_set_memory_args { > remote_nonnull_domain dom; > unsigned hyper memory; > @@ -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_SET_MAX_MEMORY_FLAGS = 207 > > /* > * Notice how the entries are grouped in sets of 10 ? > Index: libvirt/src/remote_protocol-structs > =================================================================== > --- libvirt.orig/src/remote_protocol-structs > +++ libvirt/src/remote_protocol-structs > @@ -371,6 +371,11 @@ struct remote_domain_set_max_memory_args > remote_nonnull_domain dom; > uint64_t memory; > }; > +struct remote_domain_set_max_memory_flags_args { > + remote_nonnull_domain dom; > + uint64_t memory; > + u_int flags; > +}; > struct remote_domain_set_memory_args { > remote_nonnull_domain dom; > uint64_t memory; > > > -- > libvir-list mailing list > libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list