--- daemon/remote.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/remote/remote_driver.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/remote/remote_protocol.x | 14 +++++++++++++- src/remote_protocol-structs | 12 ++++++++++++ 4 files changed, 110 insertions(+), 1 deletion(-) diff --git a/daemon/remote.c b/daemon/remote.c index 51dbd01..c92223e 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -4662,6 +4662,50 @@ cleanup: return rv; } +static int +remoteDispatchDomainGetJobStats(virNetServerPtr server ATTRIBUTE_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, + remote_domain_get_job_stats_args *args, + remote_domain_get_job_stats_ret *ret) +{ + virDomainPtr dom = NULL; + virTypedParameterPtr params = NULL; + int nparams = 0; + int rv = -1; + struct daemonClientPrivate *priv = + virNetServerClientGetPrivateData(client); + + if (!priv->conn) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + goto cleanup; + } + + if (!(dom = get_nonnull_domain(priv->conn, args->dom))) + goto cleanup; + + if (virDomainGetJobStats(dom, &ret->type, ¶ms, + &nparams, args->flags) < 0) + goto cleanup; + + if (remoteSerializeTypedParameters(params, nparams, + &ret->params.params_val, + &ret->params.params_len, + 0) < 0) + goto cleanup; + + rv = 0; + +cleanup: + if (rv < 0) + virNetMessageSaveError(rerr); + virTypedParamsFree(params, nparams); + if (dom) + virDomainFree(dom); + return rv; +} + /*----- Helpers. -----*/ /* get_nonnull_domain and get_nonnull_network turn an on-wire diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 5a4b3c7..f35c44f 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -5934,6 +5934,46 @@ done: return rv; } +static int +remoteDomainGetJobStats(virDomainPtr domain, + int *type, + virTypedParameterPtr *params, + int *nparams, + unsigned int flags) +{ + int rv = -1; + remote_domain_get_job_stats_args args; + remote_domain_get_job_stats_ret ret; + struct private_data *priv = domain->conn->privateData; + + remoteDriverLock(priv); + + make_nonnull_domain(&args.dom, domain); + args.flags = flags; + + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_JOB_STATS, + (xdrproc_t) xdr_remote_domain_get_job_stats_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_get_job_stats_ret, (char *) &ret) == -1) + goto done; + + *type = ret.type; + + if (remoteDeserializeTypedParameters(ret.params.params_val, + ret.params.params_len, + 0, params, nparams) < 0) + goto cleanup; + + rv = 0; + +cleanup: + xdr_free((xdrproc_t) xdr_remote_domain_get_job_stats_ret, + (char *) &ret); +done: + remoteDriverUnlock(priv); + return rv; +} + static void remoteDomainEventQueue(struct private_data *priv, virDomainEventPtr event) @@ -6193,6 +6233,7 @@ static virDriver remote_driver = { .cpuCompare = remoteCPUCompare, /* 0.7.5 */ .cpuBaseline = remoteCPUBaseline, /* 0.7.7 */ .domainGetJobInfo = remoteDomainGetJobInfo, /* 0.7.7 */ + .domainGetJobStats = remoteDomainGetJobStats, /* 1.0.3 */ .domainAbortJob = remoteDomainAbortJob, /* 0.7.7 */ .domainMigrateSetMaxDowntime = remoteDomainMigrateSetMaxDowntime, /* 0.8.0 */ .domainMigrateSetMaxSpeed = remoteDomainMigrateSetMaxSpeed, /* 0.9.0 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 5ace31f..306d6b2 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -2156,6 +2156,17 @@ struct remote_domain_get_job_info_ret { /* insert@1 */ }; +struct remote_domain_get_job_stats_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + +struct remote_domain_get_job_stats_ret { + int type; + remote_typed_param params<>; +}; + + struct remote_domain_abort_job_args { remote_nonnull_domain dom; }; @@ -3060,7 +3071,8 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_FSTRIM = 294, /* autogen autogen */ REMOTE_PROC_DOMAIN_SEND_PROCESS_SIGNAL = 295, /* autogen autogen */ REMOTE_PROC_DOMAIN_OPEN_CHANNEL = 296, /* autogen autogen | readstream@2 */ - REMOTE_PROC_NODE_DEVICE_LOOKUP_SCSI_HOST_BY_WWN = 297 /* autogen autogen priority:high */ + REMOTE_PROC_NODE_DEVICE_LOOKUP_SCSI_HOST_BY_WWN = 297, /* autogen autogen priority:high */ + REMOTE_PROC_DOMAIN_GET_JOB_STATS = 298 /* skipgen skipgen */ /* * Notice how the entries are grouped in sets of 10 ? diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 7f5ff7a..54b6009 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1634,6 +1634,17 @@ struct remote_domain_get_job_info_ret { uint64_t fileProcessed; uint64_t fileRemaining; }; +struct remote_domain_get_job_stats_args { + remote_nonnull_domain dom; + u_int flags; +}; +struct remote_domain_get_job_stats_ret { + int type; + struct { + u_int params_len; + remote_typed_param * params_val; + } params; +}; struct remote_domain_abort_job_args { remote_nonnull_domain dom; }; @@ -2462,4 +2473,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SEND_PROCESS_SIGNAL = 295, REMOTE_PROC_DOMAIN_OPEN_CHANNEL = 296, REMOTE_PROC_NODE_DEVICE_LOOKUP_SCSI_HOST_BY_WWN = 297, + REMOTE_PROC_DOMAIN_GET_JOB_STATS = 298, }; -- 1.8.1.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list