[PATCHv2 6/8] remote: introduce remoteGetSchedulerParametersFlags

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

 



* 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 75abddd..bc9fd3b 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -685,6 +685,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;
+    virTypedParameterPtr 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 79ee8e7..ef1b785 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2467,6 +2467,45 @@ done:
 }

 static int
+remoteDomainGetSchedulerParametersFlags (virDomainPtr domain,
+                                         virTypedParameterPtr 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,
                                     virTypedParameterPtr params, int nparams)
 {
@@ -6424,7 +6463,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 */
@@ -6478,7 +6519,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 00ea1b8..eb0783c 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -434,6 +434,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>;
@@ -2265,7 +2275,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 ?
      * Nice isn't it. Please keep it this way when adding more.
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 86ad107..9e4a92a 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]