File xend-xm-reboot-fix.patch of Package xen.1317

References: bnc#840997

Index: xen-4.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.4.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -435,7 +435,17 @@ class XendDomainInfo:
             if i != 0:
                 self.vmpath = self.vmpath + '-' + str(i)
             try:
-                if self._readVm("uuid"):
+                # On reboot, the old VM may not be completely gone causing
+                # duplicate VMs to appear one of which has '-1' appended to
+                # the uuid. This can lead to VM corruption.
+                timeout = 0
+                while timeout < 5:
+                    if self._readVm("uuid"):
+                        time.sleep(0.1)
+                        timeout += 1
+                    else:
+                        break
+                if timeout >= 5:
                     self.vmpath = None
                     i = i + 1
             except:
openSUSE Build Service is sponsored by