[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 5/7] remote: introduce remoteGetSchedulerParametersFlags



* daemon/remote.c (remoteDispatchDomainGetSchedulerParameters):
New function.
* src/remote/remote_driver.c (remoteDomainGetSchedulerParameters):
Likewise.
* src/remote/remote_protocol.x
(remote_domain_get_scheduler_parameters_flags_args)
(remote_domain_get_scheduler_parameters_flags_ret): New types.
(remote_procedure): New RPC.
* src/remote_protocol-structs: Likewise.
---
 daemon/remote.c              |   53 ++++++++++++++++++++++++++++++++++++++++++
 src/remote/remote_driver.c   |   42 ++++++++++++++++++++++++++++++++-
 src/remote/remote_protocol.x |   13 +++++++++-
 src/remote_protocol-structs  |   11 ++++++++
 4 files changed, 117 insertions(+), 2 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 001e5bf..4ec5e96 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -721,6 +721,59 @@ no_memory:
 }

 static int
+remoteDispatchDomainGetSchedulerParametersFlags(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_get_scheduler_parameters_flags_args *args,
+                                                remote_domain_get_scheduler_parameters_flags_ret *ret)
+{
+    virDomainPtr dom = NULL;
+    virSchedParameterPtr params = NULL;
+    int nparams = args->nparams;
+    int rv = -1;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
+        goto cleanup;
+    }
+    if (VIR_ALLOC_N(params, nparams) < 0)
+        goto no_memory;
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if (virDomainGetSchedulerParametersFlags(dom, params, &nparams,
+                                             args->flags) < 0)
+        goto cleanup;
+
+    if (remoteSerializeTypedParameters(params, nparams,
+                                       &ret->params.params_len,
+                                       &ret->params.params_val) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    VIR_FREE(params);
+    return rv;
+
+no_memory:
+    virReportOOMError();
+    goto cleanup;
+}
+
+static int
 remoteDispatchDomainSetSchedulerParameters(struct qemud_server *server ATTRIBUTE_UNUSED,
                                            struct qemud_client *client ATTRIBUTE_UNUSED,
                                            virConnectPtr conn,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 5348ea3..76cc24b 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2500,6 +2500,45 @@ done:
 }

 static int
+remoteDomainGetSchedulerParametersFlags (virDomainPtr domain,
+                                         virSchedParameterPtr params,
+                                         int *nparams,
+                                         unsigned int flags)
+{
+    int rv = -1;
+    remote_domain_get_scheduler_parameters_flags_args args;
+    remote_domain_get_scheduler_parameters_flags_ret ret;
+    struct private_data *priv = domain->conn->privateData;
+
+    remoteDriverLock(priv);
+
+    make_nonnull_domain (&args.dom, domain);
+    args.nparams = *nparams;
+    args.flags = flags;
+
+    memset (&ret, 0, sizeof ret);
+    if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS,
+              (xdrproc_t) xdr_remote_domain_get_scheduler_parameters_flags_args, (char *) &args,
+              (xdrproc_t) xdr_remote_domain_get_scheduler_parameters_flags_ret, (char *) &ret) == -1)
+        goto done;
+
+    if (remoteDeserializeTypedParameters(ret.params.params_len,
+                                         ret.params.params_val,
+                                         REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX,
+                                         params,
+                                         nparams) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    xdr_free ((xdrproc_t) xdr_remote_domain_get_scheduler_parameters_flags_ret, (char *) &ret);
+done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
+static int
 remoteDomainSetSchedulerParameters (virDomainPtr domain,
                                     virSchedParameterPtr params, int nparams)
 {
@@ -6676,7 +6715,9 @@ static virDriver remote_driver = {
     .domainSetAutostart = remoteDomainSetAutostart, /* 0.3.0 */
     .domainGetSchedulerType = remoteDomainGetSchedulerType, /* 0.3.0 */
     .domainGetSchedulerParameters = remoteDomainGetSchedulerParameters, /* 0.3.0 */
+    .domainGetSchedulerParametersFlags = remoteDomainGetSchedulerParametersFlags, /* 0.9.2 */
     .domainSetSchedulerParameters = remoteDomainSetSchedulerParameters, /* 0.3.0 */
+    .domainSetSchedulerParametersFlags = remoteDomainSetSchedulerParametersFlags, /* 0.9.2 */
     .domainMigratePrepare = remoteDomainMigratePrepare, /* 0.3.2 */
     .domainMigratePerform = remoteDomainMigratePerform, /* 0.3.2 */
     .domainMigrateFinish = remoteDomainMigrateFinish, /* 0.3.2 */
@@ -6730,7 +6771,6 @@ static virDriver remote_driver = {
     .domainMigratePerform3 = remoteDomainMigratePerform3, /* 0.9.2 */
     .domainMigrateFinish3 = remoteDomainMigrateFinish3, /* 0.9.2 */
     .domainMigrateConfirm3 = remoteDomainMigrateConfirm3, /* 0.9.2 */
-    .domainSetSchedulerParametersFlags = remoteDomainSetSchedulerParametersFlags, /* 0.9.2 */
 };

 static virNetworkDriver network_driver = {
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 16141df..87daef2 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -431,6 +431,16 @@ struct remote_domain_get_scheduler_parameters_ret {
     remote_typed_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
 };

+struct remote_domain_get_scheduler_parameters_flags_args {
+    remote_nonnull_domain dom;
+    int nparams;
+    unsigned int flags;
+};
+
+struct remote_domain_get_scheduler_parameters_flags_ret {
+    remote_typed_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
+};
+
 struct remote_domain_set_scheduler_parameters_args {
     remote_nonnull_domain dom;
     remote_typed_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
@@ -2251,7 +2261,8 @@ enum remote_procedure {
     REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3 = 216, /* skipgen skipgen */
     REMOTE_PROC_DOMAIN_MIGRATE_FINISH3 = 217, /* skipgen skipgen */
     REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3 = 218, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS = 219 /* skipgen skipgen */
+    REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS = 219, /* skipgen skipgen */
+    REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS = 220 /* 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 64222cc..ff54746 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -151,6 +151,17 @@ struct remote_domain_get_scheduler_parameters_ret {
                 remote_typed_param * params_val;
         } params;
 };
+struct remote_domain_get_scheduler_parameters_flags_args {
+        remote_nonnull_domain      dom;
+        int                        nparams;
+        u_int                      flags;
+};
+struct remote_domain_get_scheduler_parameters_flags_ret {
+        struct {
+                u_int              params_len;
+                remote_typed_param * params_val;
+        } params;
+};
 struct remote_domain_set_scheduler_parameters_args {
         remote_nonnull_domain      dom;
         struct {
-- 
1.7.4.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]