Skip to contentSkip to conversation

attempt to reset logdirty if enable fails

PATCH New Brendan Cully 1 participant 1 message Apr 30, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 attempt to reset logdirty if enable fails

Hi,

If the xc_save process ends gracelessly, it may leave logdirty mode enabled. This prevents subsequent attempts to live-migrate the domain from succeeding, because the call to enable logdirty will fail (failure is overloaded to mean both real failure and that the mode is already enabled). I don't know how often this happens to people not fiddling with the live migration code, but it's a theoretical possibility and there's a fairly simple workaround: try turning the mode off and then back on. If both succeed, everything should be fine. Here's a patch that does this.

An operation to test the current shadow mode might also be nice.

# HG changeset patch
# User Brendan Cully <[email protected]>
# Date 1177973594 25200
# Node ID ab6f47595b9c39fa1b68372daeb0a88c0f1da43c
# Parent 0f9b97523450aae06d42852bdac9bbca3d6033d1
If ENABLE_LOGDIRTY fails, it may be because it is already active. To find out, attempt to disable and then reenable the mode.

tools/libxc/xc_domain_save.c +11 -2
diff -r 0f9b97523450 -r ab6f47595b9c tools/libxc/xc_domain_save.c
@@ -880,8 +880,17 @@ int xc_domain_save(int xc_handle, int io
                                XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
                                NULL, 0, NULL, 0, NULL) < 0 )
         {
-            ERROR("Couldn't enable shadow mode");
-            goto out;
+            /* log-dirty already enabled? There's no test op,
+               so attempt to disable then reenable it */
+            if ( !(xc_shadow_control(xc_handle, dom, XEN_DOMCTL_SHADOW_OP_OFF,
+                                     NULL, 0, NULL, 0, NULL) >= 0 &&
+                   xc_shadow_control(xc_handle, dom,
+                                     XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
+                                     NULL, 0, NULL, 0, NULL) >= 0) )
+            {
+                ERROR("Couldn't enable shadow mode");
+                goto out;
+            }
         }
 
         if ( hvm )

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