ia64/xen-unstable

changeset 17173:a142ddb40b1c

Fix xm vcpu-pin for inactive managed domains

We cannot currently change cpu affinity definitions of inactive
managed domains by xm vcpu-pin command. This patch enables changing
cpu affinity definitions of inactive managed domains. However, we
cannot change cpu affinity definitions to each vcpu because we cannot
currently define cpu affinity definitions to each vcpu to domain
configuration definitions. Therefore, we need to specify 'all' to
VCPU argument of xm vcpu-pin command.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 03 11:09:33 2008 +0000 (2008-03-03)
parents 990eb630033a
children c89f6ed56351
files tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Mon Mar 03 11:08:10 2008 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Mon Mar 03 11:09:33 2008 +0000
     1.3 @@ -1364,13 +1364,23 @@ class XendDomain:
     1.4         
     1.5          # set the same cpumask for all vcpus
     1.6          rc = 0
     1.7 -        for v in vcpus:
     1.8 -            try:
     1.9 -                rc = xc.vcpu_setaffinity(dominfo.getDomid(), int(v), cpumap)
    1.10 -            except Exception, ex:
    1.11 -                log.exception(ex)
    1.12 -                raise XendError("Cannot pin vcpu: %s to cpu: %s - %s" % \
    1.13 -                                (v, cpumap, str(ex)))
    1.14 +        if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
    1.15 +            for v in vcpus:
    1.16 +                try:
    1.17 +                    rc = xc.vcpu_setaffinity(dominfo.getDomid(), int(v), cpumap)
    1.18 +                except Exception, ex:
    1.19 +                    log.exception(ex)
    1.20 +                    raise XendError("Cannot pin vcpu: %s to cpu: %s - %s" % \
    1.21 +                                    (v, cpumap, str(ex)))
    1.22 +        else:
    1.23 +            # FIXME: if we could define cpu affinity definitions to
    1.24 +            #        each vcpu, reprogram the following processing.
    1.25 +            if str(vcpu).lower() != "all":
    1.26 +                raise XendError("Must specify 'all' to VCPU "
    1.27 +                                "for inactive managed domains")
    1.28 +            dominfo.setCpus(cpumap)
    1.29 +            self.managed_config_save(dominfo)
    1.30 +
    1.31          return rc
    1.32  
    1.33      def domain_cpu_sedf_set(self, domid, period, slice_, latency, extratime,
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Mar 03 11:08:10 2008 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Mar 03 11:09:33 2008 +0000
     2.3 @@ -1394,6 +1394,12 @@ class XendDomainInfo:
     2.4      def setResume(self, isresume):
     2.5          self._resume = isresume
     2.6  
     2.7 +    def getCpus(self):
     2.8 +        return self.info['cpus']
     2.9 +
    2.10 +    def setCpus(self, cpumap):
    2.11 +        self.info['cpus'] = cpumap
    2.12 +
    2.13      def getCap(self):
    2.14          return self.info['vcpus_params']['cap']
    2.15