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

[libvirt] [PATCH v4 3/4] vcpupin: implement the remote protocol to address the new API



This patch implements the remote protocol to address the new API
(virDomainPinVcpuFlags).

Signd-off-by: Taku Izumi <izumi taku jp fujitsu com>
---
 daemon/remote.c              |   42
++++++++++++++++++++++++++++++++++++++++++
 src/remote/remote_driver.c   |    1 +
 src/remote/remote_protocol.x |   10 +++++++++-
 src/remote_protocol-structs  |    9 +++++++++
 4 files changed, 61 insertions(+), 1 deletion(-)

Index: libvirt/src/remote/remote_protocol.x
===================================================================
--- libvirt.orig/src/remote/remote_protocol.x
+++ libvirt/src/remote/remote_protocol.x
@@ -837,6 +837,13 @@ struct remote_domain_pin_vcpu_args {
     opaque cpumap<REMOTE_CPUMAP_MAX>;
 };
 
+struct remote_domain_pin_vcpu_flags_args {
+    remote_nonnull_domain dom;
+    int vcpu;
+    opaque cpumap<REMOTE_CPUMAP_MAX>;
+    unsigned int flags;
+};
+
 struct remote_domain_get_vcpus_args {
     remote_nonnull_domain dom;
     int maxinfo;
@@ -2297,7 +2304,8 @@ enum remote_procedure {
     REMOTE_PROC_INTERFACE_CHANGE_COMMIT = 221, /* autogen autogen */
     REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK = 222, /* autogen autogen */
     REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS = 223, /* skipgen
autogen */
-    REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR = 224 /* skipgen skipgen */
+    REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR = 224, /* skipgen skipgen */
+    REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS = 225 /* skipgen autogen */
 
     /*
      * 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
@@ -529,6 +529,15 @@ struct remote_domain_pin_vcpu_args {
                 char *             cpumap_val;
         } cpumap;
 };
+struct remote_domain_pin_vcpu_flags_args {
+        remote_nonnull_domain      dom;
+        int                        vcpu;
+        struct {
+                u_int              cpumap_len;
+                char *             cpumap_val;
+        } cpumap;
+        u_int                      flags;
+};
 struct remote_domain_get_vcpus_args {
         remote_nonnull_domain      dom;
         int                        maxinfo;
Index: libvirt/src/remote/remote_driver.c
===================================================================
--- libvirt.orig/src/remote/remote_driver.c
+++ libvirt/src/remote/remote_driver.c
@@ -6259,6 +6259,7 @@ static virDriver remote_driver = {
     .domainSetVcpusFlags = remoteDomainSetVcpusFlags, /* 0.8.5 */
     .domainGetVcpusFlags = remoteDomainGetVcpusFlags, /* 0.8.5 */
     .domainPinVcpu = remoteDomainPinVcpu, /* 0.3.0 */
+    .domainPinVcpuFlags = remoteDomainPinVcpuFlags, /* 0.9.2 */
     .domainGetVcpus = remoteDomainGetVcpus, /* 0.3.0 */
     .domainGetMaxVcpus = remoteDomainGetMaxVcpus, /* 0.3.0 */
     .domainGetSecurityLabel = remoteDomainGetSecurityLabel, /* 0.6.1 */
Index: libvirt/daemon/remote.c
===================================================================
--- libvirt.orig/daemon/remote.c
+++ libvirt/daemon/remote.c
@@ -1277,6 +1277,48 @@ cleanup:
 }
 
 static int
+remoteDispatchDomainPinVcpuFlags(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_pin_vcpu_flags_args *args,
+                                 void *ret ATTRIBUTE_UNUSED)
+{
+    virDomainPtr dom = NULL;
+    int rv = -1;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+        goto cleanup;
+    }
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if (args->cpumap.cpumap_len > REMOTE_CPUMAP_MAX) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("cpumap_len >
REMOTE_CPUMAP_MAX"));
+        goto cleanup;
+    }
+
+    if (virDomainPinVcpuFlags(dom,
+                              args->vcpu,
+                              (unsigned char *) args->cpumap.cpumap_val,
+                              args->cpumap.cpumap_len,
+                              args->flags) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
+
+static int
 remoteDispatchDomainGetMemoryParameters(struct qemud_server *server
                                         ATTRIBUTE_UNUSED,
                                         struct qemud_client *client



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