]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
tools/migration: Drop IHDR_VERSION constant from libxc and python
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 16 Dec 2019 18:53:02 +0000 (18:53 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 May 2020 16:33:03 +0000 (17:33 +0100)
Migration v3 is in the process of being introduced, meaning that the code has
to cope with both versions.  Use an explicit 2 for now.

For the verify-stream-v2 and convert-legacy-stream scripts, update text to say
"v2 (or later)".  What matters is the distinction vs legacy streams.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxc/xc_sr_restore.c
tools/libxc/xc_sr_save.c
tools/libxc/xc_sr_stream_format.h
tools/python/scripts/convert-legacy-stream
tools/python/scripts/verify-stream-v2
tools/python/xen/migration/libxc.py

index 5e31908ca801e404629a6e764d040ba87307b748..dc2ffcf855d98dde9adbff5cf6c5914bdd47eb2e 100644 (file)
@@ -35,10 +35,10 @@ static int read_headers(struct xc_sr_context *ctx)
         return -1;
     }
 
-    if ( ihdr.version != IHDR_VERSION )
+    if ( ihdr.version != 2 )
     {
-        ERROR("Invalid Version: Expected %d, Got %d",
-              IHDR_VERSION, ihdr.version);
+        ERROR("Invalid Version: Expected 2, Got %d",
+              ihdr.version);
         return -1;
     }
 
index 6ba6623ff33234607a7b00087c4bc24838c3d2cf..02e140b3000e48846b9ea71153539de7c1789a75 100644 (file)
@@ -13,7 +13,7 @@ static int write_headers(struct xc_sr_context *ctx, uint16_t guest_type)
     struct xc_sr_ihdr ihdr = {
         .marker  = IHDR_MARKER,
         .id      = htonl(IHDR_ID),
-        .version = htonl(IHDR_VERSION),
+        .version = htonl(2),
         .options = htons(IHDR_OPT_LITTLE_ENDIAN),
     };
     struct xc_sr_dhdr dhdr = {
index 37a7da6eab670e6caf13efaa15107f98157c804b..ae7c0de393ac017b0bb9a90fe31dbc8e35bc44a6 100644 (file)
@@ -23,7 +23,6 @@ struct xc_sr_ihdr
 
 #define IHDR_MARKER  0xffffffffffffffffULL
 #define IHDR_ID      0x58454E46U
-#define IHDR_VERSION 2
 
 #define _IHDR_OPT_ENDIAN 0
 #define IHDR_OPT_LITTLE_ENDIAN (0 << _IHDR_OPT_ENDIAN)
index 2922fb3185c2b0bd24a5815a7c09e3df414be3b4..02a194178fc927bec1e28fdf526f80927406f77b 100755 (executable)
@@ -79,7 +79,7 @@ def write_libxc_ihdr():
     stream_write(pack(libxc.IHDR_FORMAT,
                       libxc.IHDR_MARKER,  # Marker
                       libxc.IHDR_IDENT,   # Ident
-                      libxc.IHDR_VERSION, # Version
+                      2,                  # Version
                       libxc.IHDR_OPT_LE,  # Options
                       0, 0))              # Reserved
 
@@ -632,13 +632,13 @@ def main():
                           usage = ("%prog [options] -i INPUT -o OUTPUT"
                                    " -w WIDTH -g GUEST"),
                           description =
-                          "Convert a legacy stream to a v2 stream")
+                          "Convert a legacy stream to a v2 (or later) stream")
 
     # Required options
     parser.add_option("-i", "--in", dest = "fin", metavar = "<FD or FILE>",
                       help = "Legacy input to convert")
     parser.add_option("-o", "--out", dest = "fout", metavar = "<FD or FILE>",
-                      help = "v2 format output")
+                      help = "v2 (or later) format output")
     parser.add_option("-w", "--width", dest = "twidth",
                       metavar = "<32/64>", choices = ["32", "64"],
                       help = "Legacy toolstack bitness")
index 8bac04d5666f81b4add8a5cce6a465f6d44b763b..fe82b86c11cd5b7c4ebd597f0fd37a79cc00a562 100755 (executable)
@@ -108,7 +108,7 @@ def main():
 
     parser = OptionParser(usage = "%prog [options]",
                           description =
-                          "Verify a stream according to the v2 spec")
+                          "Verify a stream according to the v2 (or later) spec")
 
     # Optional options
     parser.add_option("-i", "--in", dest = "fin", metavar = "<FD or FILE>",
index 8a800df980c6c9b39fa4b95ab4b26e45c63acaa6..63b355802944a9723a6c4c180aadd4116fca3603 100644 (file)
@@ -19,7 +19,6 @@ IHDR_FORMAT = "!QIIHHI"
 
 IHDR_MARKER  = 0xffffffffffffffff
 IHDR_IDENT   = 0x58454E46 # "XENF" in ASCII
-IHDR_VERSION = 2
 
 IHDR_OPT_BIT_ENDIAN = 0
 IHDR_OPT_LE = (0 << IHDR_OPT_BIT_ENDIAN)
@@ -113,7 +112,7 @@ HVM_PARAMS_ENTRY_FORMAT   = "QQ"
 HVM_PARAMS_FORMAT         = "II"
 
 class VerifyLibxc(VerifyBase):
-    """ Verify a Libxc v2 stream """
+    """ Verify a Libxc v2 (or later) stream """
 
     def __init__(self, info, read):
         VerifyBase.__init__(self, info, read)
@@ -144,9 +143,9 @@ class VerifyLibxc(VerifyBase):
             raise StreamError("Bad image id: Expected 0x%x, got 0x%x" %
                               (IHDR_IDENT, ident))
 
-        if version != IHDR_VERSION:
-            raise StreamError("Unknown image version: Expected %d, got %d" %
-                              (IHDR_VERSION, version))
+        if version != 2:
+            raise StreamError("Unknown image version: Expected 2, got %d" %
+                              (version, ))
 
         if options & IHDR_OPT_RESZ_MASK:
             raise StreamError("Reserved bits set in image options field: 0x%x" %