]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
xend: Fix for op_pincpu in SrvDomain.py
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 27 Apr 2009 14:42:38 +0000 (15:42 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 27 Apr 2009 14:42:38 +0000 (15:42 +0100)
op_pincpu method in SrvDomain.py does not currently work because
op_pincpu method gives string objects to a cpumap argument of
domain_pincpu method in XendDomain.py though the cpumap argument
expects list objects.

This patch solves the above problem as follows.

op_pincpu method gives string objects to the cpumap argument as is,
because op_pincpu method cannot give list objects to the cpumap
argument.
Instead, domain_pincpu method expects that the cpumap argument is
string objects, then domain_pincpu method converts the cpumap
argument into list objects.
Also, the patch modifies two methods (except for op_pincpu method)
calling domain_pincpu method.  The methods give string objects to
the cpumap argument instead of list objects.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
tools/python/xen/xend/XendAPI.py
tools/python/xen/xend/XendDomain.py
tools/python/xen/xm/main.py

index fb39fd87c747e6271792edc003f18790427dd60e..07e6b2100ecd7a41a1d0a0abfc2694bb3a6c13d5 100644 (file)
@@ -1509,8 +1509,7 @@ class XendAPI(object):
             if key.startswith("cpumap"):
                 vcpu = int(key[6:])
                 try:
-                    cpus = map(int, value.split(","))
-                    xendom.domain_pincpu(xeninfo.getDomid(), vcpu, cpus)
+                    xendom.domain_pincpu(xeninfo.getDomid(), vcpu, value)
                 except Exception, ex:
                     log.exception(ex)
 
index b624f786ad160c2cc35b5ebbd66b3cf561ddf390..a8ee276df874a1cfd5e24e426f9e30eb49553f96 100644 (file)
@@ -1442,6 +1442,7 @@ class XendDomain:
         # set the same cpumask for all vcpus
         rc = 0
         cpus = dominfo.getCpus()
+        cpumap = map(int, cpumap.split(","))
         for v in vcpus:
             try:
                 if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
index a7b375dafaba7d4a9f1614cac5ebb04442d0ca58..ae3bc5a91448b519e0cb475a034488e5c77e9e1c 100644 (file)
@@ -1379,7 +1379,7 @@ def xm_vcpu_pin(args):
                 else:
                     cpus.append(int(c))
         cpus.sort()
-        return cpus
+        return ",".join(map(str, cpus))
 
     dom  = args[0]
     vcpu = args[1]
@@ -1389,9 +1389,8 @@ def xm_vcpu_pin(args):
         cpumap = cpu_make_map(args[2])
 
     if serverType == SERVER_XEN_API:
-        cpumap = map(str, cpumap)        
         server.xenapi.VM.add_to_VCPUs_params_live(
-            get_single_vm(dom), "cpumap%i" % int(vcpu), ",".join(cpumap))
+            get_single_vm(dom), "cpumap%i" % int(vcpu), cpumap)
     else:
         server.xend.domain.pincpu(dom, vcpu, cpumap)