From 118dd7d06ec0bd04f76350ad2b6eb9c26e18b076 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Thu, 17 Feb 2011 14:26:14 +0000 Subject: [PATCH] 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 ++++++++- src/remote_protocol-structs | 5 +++++ 9 files changed, 108 insertions(+), 2 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index f410982339..a8fef4d124 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -6562,6 +6562,34 @@ remoteDispatchDomainMigrateSetMaxDowntime(struct qemud_server *server ATTRIBUTE_ return 0; } +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, diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h index b32ae1f88d..15fa1a01ab 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 4db6c769e4..3fcf87c844 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 c50d038826..c5f6653d0d 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 5a753ab2a8..40da5c233d 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -9183,6 +9183,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, @@ -11156,7 +11185,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 ea2bdf7b8f..7ecea9d1ff 100644 --- a/src/remote/remote_protocol.c +++ b/src/remote/remote_protocol.c @@ -3507,6 +3507,19 @@ xdr_remote_domain_migrate_set_max_downtime_args (XDR *xdrs, remote_domain_migrat return TRUE; } +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 a55f7c4d84..87de0dad8b 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 aa710a497e..731068912d 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 ? diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 35d0c1ccee..81889c3b71 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1276,6 +1276,11 @@ struct remote_domain_migrate_set_max_downtime_args { uint64_t downtime; u_int flags; }; +struct remote_domain_migrate_set_max_speed_args { + remote_nonnull_domain dom; + uint64_t bandwidth; + u_int flags; +}; struct remote_domain_events_register_any_args { int eventID; }; -- GitLab