[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.1-testing] Fix xm vcpu-pin for inactive managed domains



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204735506 0
# Node ID 2ccc941ac0e6698a8588ea57a2ece25c1afc104c
# Parent  d6569e10d0c3ea1e65682fd4dfe490a617eb0a9d
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@xxxxxxxxxxxxxx>
xen-unstable changeset:   17173:a142ddb40b1c77d6b8726a2b57ac324ab74c6d06
xen-unstable date:        Mon Mar 03 11:09:33 2008 +0000
---
 tools/python/xen/xend/XendDomain.py     |   24 +++++++++++++++++-------
 tools/python/xen/xend/XendDomainInfo.py |    6 ++++++
 2 files changed, 23 insertions(+), 7 deletions(-)

diff -r d6569e10d0c3 -r 2ccc941ac0e6 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Wed Mar 05 16:44:11 2008 +0000
+++ b/tools/python/xen/xend/XendDomain.py       Wed Mar 05 16:45:06 2008 +0000
@@ -1300,13 +1300,23 @@ class XendDomain:
        
         # set the same cpumask for all vcpus
         rc = 0
-        for v in vcpus:
-            try:
-                rc = xc.vcpu_setaffinity(dominfo.getDomid(), int(v), cpumap)
-            except Exception, ex:
-                log.exception(ex)
-                raise XendError("Cannot pin vcpu: %s to cpu: %s - %s" % \
-                                (v, cpumap, str(ex)))
+        if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+            for v in vcpus:
+                try:
+                    rc = xc.vcpu_setaffinity(dominfo.getDomid(), int(v), 
cpumap)
+                except Exception, ex:
+                    log.exception(ex)
+                    raise XendError("Cannot pin vcpu: %s to cpu: %s - %s" % \
+                                    (v, cpumap, str(ex)))
+        else:
+            # FIXME: if we could define cpu affinity definitions to
+            #        each vcpu, reprogram the following processing.
+            if str(vcpu).lower() != "all":
+                raise XendError("Must specify 'all' to VCPU "
+                                "for inactive managed domains")
+            dominfo.setCpus(cpumap)
+            self.managed_config_save(dominfo)
+
         return rc
 
     def domain_cpu_sedf_set(self, domid, period, slice_, latency, extratime,
diff -r d6569e10d0c3 -r 2ccc941ac0e6 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Mar 05 16:44:11 2008 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Mar 05 16:45:06 2008 +0000
@@ -1094,6 +1094,12 @@ class XendDomainInfo:
     def getResume(self):
         return str(self._resume)
 
+    def getCpus(self):
+        return self.info['cpus']
+
+    def setCpus(self, cpumap):
+        self.info['cpus'] = cpumap
+
     def getCap(self):
         return self.info.get('cpu_cap', 0)
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.