From: Mark Williamson Subject: [PATCH] [BUGFIX] Disallow save / migrate of a domain with real PCI devices Date: Fri, 29 Jun 2007 19:01:09 +0100 Message-ID: <200706291901.10811.mark.williamson@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_mjUhGfNg228gG/Q" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "Petersson, Mats" , xen-devel@lists.xensource.com, Ian Campbell List-Id: xen-devel@lists.xenproject.org --Boundary-00=_mjUhGfNg228gG/Q Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. Signed-off-by: Mark Williamson -- 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! --Boundary-00=_mjUhGfNg228gG/Q Content-Type: all/allfiles; name="forbid-susp-pcidom.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="forbid-susp-pcidom.patch" # HG changeset patch # User mark.williamson@cl.cam.ac.uk # 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. Signed-off-by: Mark Williamson diff -r 5eec9a8825d4 -r c18b9e875ecc tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Wed Jun 27 20:08:21 2007 +0100 +++ b/tools/python/xen/xend/server/pciif.py Fri Jun 29 17:55:57 2007 +0100 @@ -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.') --Boundary-00=_mjUhGfNg228gG/Q Content-Type: all/allfiles; name="errmsg-forbid-susp-pcidom.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="errmsg-forbid-susp-pcidom.patch" # HG changeset patch # User mark.williamson@cl.cam.ac.uk # 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! Signed-off-by: Mark Williamson diff -r c18b9e875ecc -r 3d6617b64518 tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Fri Jun 29 17:55:57 2007 +0100 +++ b/tools/python/xen/xend/XendCheckpoint.py Fri Jun 29 18:55:13 2007 +0100 @@ -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), diff -r c18b9e875ecc -r 3d6617b64518 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Fri Jun 29 17:55:57 2007 +0100 +++ b/tools/python/xen/xend/XendDomain.py Fri Jun 29 18:55:13 2007 +0100 @@ -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])) --Boundary-00=_mjUhGfNg228gG/Q Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_mjUhGfNg228gG/Q--