ia64/xen-unstable

changeset 19580:a63d20d7a941

xend: Fix for op_pincpu in SrvDomain.py

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>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Apr 27 15:42:38 2009 +0100 (2009-04-27)
parents d89f655e5698
children f734a724902b
files tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendDomain.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Mon Apr 27 15:41:28 2009 +0100
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Mon Apr 27 15:42:38 2009 +0100
     1.3 @@ -1509,8 +1509,7 @@ class XendAPI(object):
     1.4              if key.startswith("cpumap"):
     1.5                  vcpu = int(key[6:])
     1.6                  try:
     1.7 -                    cpus = map(int, value.split(","))
     1.8 -                    xendom.domain_pincpu(xeninfo.getDomid(), vcpu, cpus)
     1.9 +                    xendom.domain_pincpu(xeninfo.getDomid(), vcpu, value)
    1.10                  except Exception, ex:
    1.11                      log.exception(ex)
    1.12  
     2.1 --- a/tools/python/xen/xend/XendDomain.py	Mon Apr 27 15:41:28 2009 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomain.py	Mon Apr 27 15:42:38 2009 +0100
     2.3 @@ -1442,6 +1442,7 @@ class XendDomain:
     2.4          # set the same cpumask for all vcpus
     2.5          rc = 0
     2.6          cpus = dominfo.getCpus()
     2.7 +        cpumap = map(int, cpumap.split(","))
     2.8          for v in vcpus:
     2.9              try:
    2.10                  if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
     3.1 --- a/tools/python/xen/xm/main.py	Mon Apr 27 15:41:28 2009 +0100
     3.2 +++ b/tools/python/xen/xm/main.py	Mon Apr 27 15:42:38 2009 +0100
     3.3 @@ -1379,7 +1379,7 @@ def xm_vcpu_pin(args):
     3.4                  else:
     3.5                      cpus.append(int(c))
     3.6          cpus.sort()
     3.7 -        return cpus
     3.8 +        return ",".join(map(str, cpus))
     3.9  
    3.10      dom  = args[0]
    3.11      vcpu = args[1]
    3.12 @@ -1389,9 +1389,8 @@ def xm_vcpu_pin(args):
    3.13          cpumap = cpu_make_map(args[2])
    3.14  
    3.15      if serverType == SERVER_XEN_API:
    3.16 -        cpumap = map(str, cpumap)        
    3.17          server.xenapi.VM.add_to_VCPUs_params_live(
    3.18 -            get_single_vm(dom), "cpumap%i" % int(vcpu), ",".join(cpumap))
    3.19 +            get_single_vm(dom), "cpumap%i" % int(vcpu), cpumap)
    3.20      else:
    3.21          server.xend.domain.pincpu(dom, vcpu, cpumap)
    3.22