Skip to contentSkip to conversation

Disallow save / migrate of a domain with real PCI devices

PATCH In review Mark Williamson 2 participants 2 messages Jun 29, 2007 – Jul 2, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Disallow save / migrate of a domain with real PCI devices

If a domain has PCI devices then we can't safely save or migrate it.

At least one user has had system crashes due to this, and the way the xendomains script automatically saves and restores domains on reboot. Since there's no sensible semantics for it at the moment, we should disallow it and return an appropriate error message to xm.

The first attached patch prevents the suspend from occurring, the second ensures that the appropriate errors are fed back to the user.

Signature · 4 lines
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!

# HG changeset patch
# User [email protected]
# Date 1183136157 -3600
# Node ID c18b9e875ecc07a1408b9993c4707f40052d9ee2 # Parent 5eec9a8825d466f76ecc847e9ecbbff5d166bbf1 Don't allow migrate with assigned PCI devs.

This can potentially cause a whole machine crash, which I think has been seen in the wild. The case in the wild was caused by xendomains auto-resuming domains on reboot, so it wasn't even operator error.

There's no sane way to migrate or suspend domains with PCI devs, so I disallow it completely.

tools/python/xen/xend/server/pciif.py +3 -0
diff -r 5eec9a8825d4 -r c18b9e875ecc tools/python/xen/xend/server/pciif.py
@@ -185,3 +185,6 @@ class PciController(DevController):
 
     def waitForBackend(self,devid):
         return (0, "ok - no hotplug")
+
+    def migrate(self, config, network, dst, step, domName):
+        raise XendError('Migration not permitted with assigned PCI device.')

# HG changeset patch
# User [email protected]
# Date 1183139713 -3600
# Node ID 3d6617b645186a7df9a0f056d8454d48a97d1df8 # Parent c18b9e875ecc07a1408b9993c4707f40052d9ee2 Pass information to user when failing migrate due to PCI dev.

When failing a migration / save due to the domain owning a PCI device make sure that we tell the user what went wrong!

tools/python/xen/xend/XendCheckpoint.py +2 -0
diff -r c18b9e875ecc -r 3d6617b64518 tools/python/xen/xend/XendCheckpoint.py
@@ -148,6 +148,8 @@ def save(fd, dominfo, network, live, dst
         except:
             log.exception("Failed to reset the migrating domain's name")
 
+        raise exn
+
 
 def restore(xd, fd, dominfo = None, paused = False):
     signature = read_exact(fd, len(SIGNATURE),
tools/python/xen/xend/XendDomain.py +3 -1
diff -r c18b9e875ecc -r 3d6617b64518 tools/python/xen/xend/XendDomain.py
@@ -1262,8 +1262,10 @@ class XendDomain:
             try:
                 XendCheckpoint.save(fd, dominfo, False, False, dst,
                                     checkpoint=checkpoint)
-            finally:
+            except Exception, e:
                 os.close(fd)
+                raise e
+            os.close(fd)
         except OSError, ex:
             raise XendError("can't write guest state file %s: %s" %
                             (dst, ex[1]))

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Looks goog to me - but I'm no expert at those paths...

--
Mats

Quoted 31 lines

-----Original Message-----
From: M.A. Williamson [mailto:[email protected]] On Behalf Of Mark Williamson
Sent: 29 June 2007 19:01
To: Keir Fraser
Cc: Ian Campbell; [email protected]; Petersson, Mats
Subject: [PATCH] [BUGFIX] Disallow save / migrate of a domain with real PCI devices

If a domain has PCI devices then we can't safely save or migrate it.

At least one user has had system crashes due to this, and the way the xendomains script automatically saves and restores domains on reboot. Since
there's no sensible semantics for it at the moment, we should disallow it and
return an appropriate error message to xm.

The first attached patch prevents the suspend from occurring, the second
ensures that the appropriate errors are fed back to the user.

Signature · 5 lines
Dave: Just a question. What use is a unicyle with no seat?  
And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!