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

[Xen-devel] [PATCH VERY RFC 4/5] tools/xl: Restore v2 streams using new libxl_domain_restore() interface



Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index e6b9615..8e0a6bb 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -136,6 +136,8 @@ static const char *action_on_shutdown_names[] = {
 
 #define SAVEFILE_BYTEORDER_VALUE ((uint32_t)0x01020304UL)
 
+#define SAVEFILE_MANDATORY_STREAMV2 (1 << 0)
+
 struct domain_create {
     int debug;
     int daemonize;
@@ -2115,7 +2117,7 @@ static uint32_t create_domain(struct domain_create 
*dom_info)
                 restore_source, hdr.mandatory_flags, hdr.optional_flags,
                 hdr.optional_data_len);
 
-        badflags = hdr.mandatory_flags & ~( 0 /* none understood yet */ );
+        badflags = hdr.mandatory_flags & ~SAVEFILE_MANDATORY_STREAMV2;
         if (badflags) {
             fprintf(stderr, "Savefile has mandatory flag(s) 0x%"PRIx32" "
                     "which are not supported; need newer xl\n",
@@ -2245,12 +2247,17 @@ start:
     }
 
     if ( restoring ) {
-        libxl_domain_restore_params params;
-        params.checkpointed_stream = dom_info->checkpointed_stream;
-        ret = libxl_domain_create_restore(ctx, &d_config,
-                                          &domid, restore_fd,
-                                          &params,
-                                          0, autoconnect_console_how);
+        if ( hdr.mandatory_flags & SAVEFILE_MANDATORY_STREAMV2 ) {
+            ret = libxl_domain_restore(ctx, &d_config, restore_fd, &domid,
+                                       0, autoconnect_console_how);
+        } else {
+            libxl_domain_restore_params params;
+            params.checkpointed_stream = dom_info->checkpointed_stream;
+            ret = libxl_domain_create_restore(ctx, &d_config,
+                                              &domid, restore_fd,
+                                              &params,
+                                              0, autoconnect_console_how);
+        }
         /*
          * On subsequent reboot etc we should create the domain, not
          * restore/migrate-receive it again.
-- 
1.7.10.4


_______________________________________________
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®.