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

Taku Izumi izumi.taku at jp.fujitsu.com
Fri May 20 09:09:49 UTC 2011


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

Signd-off-by: Taku Izumi <izumi.taku at 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
@@ -864,6 +864,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;
@@ -2291,7 +2298,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_PIN_VCPU_FLAGS = 220 /* 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
@@ -548,6 +548,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
@@ -6791,6 +6791,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
@@ -1327,6 +1327,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
 remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
                                         ATTRIBUTE_UNUSED,
                                         struct qemud_client *client




More information about the libvir-list mailing list