xend: Make _setCPUAffinity() errors nonfatal on domain resume
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 20 Nov 2008 14:17:09 +0000 (14:17 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 20 Nov 2008 14:17:09 +0000 (14:17 +0000)
This patch allows domains to be resumed on different number of CPUs. After
c/s 18764, a domain cannot be resumed when _setCPUAffinity() fails, which
happens when affinity should be set to a non-existent CPU. This patch
makes _setCPUAffinity() errors nonfatal.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
tools/python/xen/xend/XendDomainInfo.py

index eae2a6eea2cb8d51a64df55f4dc2bee68aa5f4ce..bab9d3aef2705a8b3a18eafcc75b38f56ee7edbe 100644 (file)
@@ -479,7 +479,14 @@ class XendDomainInfo:
         if state in (DOM_STATE_SUSPENDED, DOM_STATE_HALTED):
             try:
                 self._constructDomain()
-                self._setCPUAffinity()
+
+                try:
+                    self._setCPUAffinity()
+                except:
+                    # usually a CPU we want to set affinity to does not exist
+                    # we just ignore it so that the domain can still be restored
+                    log.warn("Cannot restore CPU affinity")
+
                 self._storeVmDetails()
                 self._createChannels()
                 self._createDevices()