]> xenbits.xensource.com Git - libvirt.git/commitdiff
* src/xend_internal.c: remove [] around cpumaps for recent xend
authorDaniel Veillard <veillard@redhat.com>
Thu, 14 May 2009 10:31:11 +0000 (10:31 +0000)
committerDaniel Veillard <veillard@redhat.com>
Thu, 14 May 2009 10:31:11 +0000 (10:31 +0000)
  patch by Tatsuro Enokura
daniel

ChangeLog
src/xend_internal.c

index dd1bc7514f4aa8b37738455a07235ba30e225ca5..a58a6bc3e6ff185c7961811d7cb3e510a6541888 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu May 14 12:29:41 CEST 2009 Daniel Veillard <veillard@redhat.com>
+
+       * src/xend_internal.c: remove [] around cpumaps for recent xend
+         patch by Tatsuro Enokura
+
 Wed May 13 13:37:02 EDT 2009 Cole Robinson <crobinso@redhat.com>
 
        * src/virsh.c: Fix a few 'used uninitialized' warnings.
index c410726d2e1d8b40b89c2cd2d1b780b284de0ef7..94aaa42e875c11d92ac658cae2150286fcf29d0f 100644 (file)
@@ -3765,6 +3765,11 @@ xenDaemonDomainSetVcpus(virDomainPtr domain, unsigned int vcpus)
  * @maplen: length of cpumap in bytes
  *
  * Dynamically change the real CPUs which can be allocated to a virtual CPU.
+ * NOTE: The XenD cpu affinity map format changed from "[0,1,2]" to
+ *       "0,1,2"
+ *       the XenD cpu affinity works only after cset 19579.
+ *       there is no fine grained xend version detection possible, so we
+ *       use the old format for anything before version 3
  *
  * Returns 0 for success; -1 (with errno) on error
  */
@@ -3772,8 +3777,9 @@ int
 xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
                      unsigned char *cpumap, int maplen)
 {
-    char buf[VIR_UUID_BUFLEN], mapstr[sizeof(cpumap_t) * 64] = "[";
+    char buf[VIR_UUID_BUFLEN], mapstr[sizeof(cpumap_t) * 64];
     int i, j;
+    xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
      || (cpumap == NULL) || (maplen < 1) || (maplen > (int)sizeof(cpumap_t))) {
@@ -3782,13 +3788,25 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
         return (-1);
     }
 
+    priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
+    if (priv->xendConfigVersion < 3) {
+        buf[0] = ']';
+        buf[1] = 0;
+    } else {
+        buf[0] = 0;
+    }
+
     /* from bit map, build character string of mapped CPU numbers */
     for (i = 0; i < maplen; i++) for (j = 0; j < 8; j++)
      if (cpumap[i] & (1 << j)) {
         snprintf(buf, sizeof(buf), "%d,", (8 * i) + j);
         strcat(mapstr, buf);
     }
-    mapstr[strlen(mapstr) - 1] = ']';
+    if (priv->xendConfigVersion < 3)
+        mapstr[strlen(mapstr) - 1] = ']';
+    else
+        mapstr[strlen(mapstr) - 1] = 0;
+
     snprintf(buf, sizeof(buf), "%d", vcpu);
     return(xend_op(domain->conn, domain->name, "op", "pincpu", "vcpu", buf,
                   "cpumap", mapstr, NULL));