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

Re: [Xen-devel] [PATCH] Rlibxl: refuse to try and migrate an HVM guest using qemu-xen



On Mon, 2012-07-23 at 11:58 +0100, Ian Campbell wrote:
> On Mon, 2012-07-23 at 11:52 +0100, Ian Jackson wrote:
> > Ian Campbell writes ("Re: [PATCH] Rlibxl: refuse to try and migrate an HVM 
> > guest using qemu-xen"):
> > > diff -r d29a88850da2 -r c6a2abdee84d tools/libxl/libxl.c
> > > --- a/tools/libxl/libxl.c Mon Jul 02 12:06:22 2012 +0100
> > > +++ b/tools/libxl/libxl.c Mon Jul 02 12:13:25 2012 +0100
> > > @@ -746,6 +746,22 @@ int libxl_domain_suspend(libxl_ctx *ctx,
> > ...
> > > +        switch (libxl__device_model_version_running(gc, domid)) {
> > > +        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
> > > +            LOG(ERROR,
> > > +                "cannot live migrate HVM domains with qemu-xen 
> > > device-model");
> > > +            rc = ERROR_FAIL;
> > > +            goto out_err;
> > > +        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
> > > +            /* No problem */
> > > +            break;
> > > +        default:
> > > +            rc = ERROR_FAIL;
> > > +            goto out_err;
> > > +        }
> > 
> > This last case should abort() or log something or not exist.
> 
> I think
>       case -1:
>               rc = ERROR_FAIL
>               goto out_err;
>       default: abort()
> 
> would be OK for 4.2. libxl__device_model_version_running either returns
> -1 (and logs) or a valid LIBXL_DEVICE_MODEL_VERSION_* so the only thing
> to catch is a new LIBXL_DEVICE_MODEL_VERSION_*, in which case an abort()
> seems appropriate since it would be a bug to not handle it here.
> 
> Possibly -1 ought to become LIBXL_DEVICE_MODEL_VERSION_INVALID too

Actually I think -1 == INVALID would be wrong, the -1 here really means
something went wrong internally to libxl. Anyway, I remember now that
the reason I did it this was was to avoid the need to rewrite the other
callsites for 4.2. In 4.3 we should make
libxl__device_model_version_running return ERROR_foo or something valid,
and perhaps add 0 == UNKNOWN as a member of the enum.

For now I think this will do:

8<------------------------------------------------

# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1343042178 -3600
# Node ID 11b539fb8400f163a871145aa20d7b4b2967e5b4
# Parent  21b166ed1e8765b75a2e90caa9e0e156ea4010d9
libxl: refuse to try and migrate an HVM guest using qemu-xen

libxl/qemu-upstream currently do not collude together to enable log-dirty mode
and therefore migrations are unsafe. Refuse to even try for now.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 21b166ed1e87 -r 11b539fb8400 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Jul 23 12:09:53 2012 +0100
+++ b/tools/libxl/libxl.c       Mon Jul 23 12:16:18 2012 +0100
@@ -746,6 +746,23 @@ int libxl_domain_suspend(libxl_ctx *ctx,
         goto out_err;
     }
 
+    if (type == LIBXL_DOMAIN_TYPE_HVM && flags & LIBXL_SUSPEND_LIVE) {
+        switch (libxl__device_model_version_running(gc, domid)) {
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+            LOG(ERROR,
+                "cannot live migrate HVM domains with qemu-xen device-model");
+            rc = ERROR_FAIL;
+            goto out_err;
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+            /* No problem */
+            break;
+        case -1:
+            rc = ERROR_FAIL;
+            goto out_err;
+        default: abort();
+        }
+    }
+
     libxl__domain_suspend_state *dss;
     GCNEW(dss);
 




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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