From patchwork Tue Dec 24 15:19:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11309523 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 002E06C1 for ; Tue, 24 Dec 2019 15:21:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CFE072071A for ; Tue, 24 Dec 2019 15:21:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="YqvRZH5Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFE072071A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijlyT-0000FC-7J; Tue, 24 Dec 2019 15:19:53 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijlyS-0000Ep-4r for xen-devel@lists.xenproject.org; Tue, 24 Dec 2019 15:19:52 +0000 X-Inumbo-ID: cd47db74-2660-11ea-88e7-bc764e2007e4 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cd47db74-2660-11ea-88e7-bc764e2007e4; Tue, 24 Dec 2019 15:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1577200779; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xr9uMqJBCDqqfstRuRIEWyne2KE5Ud58HiPzMMhJMIA=; b=YqvRZH5ZtlgSSaGz5QOu8TZZIwLv+tZwgrr2qRIKYAQWWXaQnCJsNzsm tDmuwFoz2Qa4IPD3u0vG4mWBPeQLiEwrWkGrSmEnqj6Kx2pqwtBvwTz+X DpumjLCUp98G9G3tP7uZCAUElGqusKu+S8K65eYBb/yQBin6ATpaYS1E/ 4=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: k6f/c7fgenuQX0JGRvo9n9YCr8uIMO6mCEMPmKczusoYW9LO4kLiHeKaqXJS6x/xgGxi34uMpV QcdyCRsakzOUUY5p2JvefYI7xRY1INqlP2E3RFhhHzLEbSEMDaCBwIeJkuRngEgSXl/LMAvFRh S32tdNV3/nUu+PUYRK3L+cDsLTKmA4hcSyy72N4Xn/WJY07sDQl6jHtal16fyYtKgdzEXej2UY LnWjunTDhm2npBqKQjJOdFtBWhVv0i3sm1J2mS/3MrqOvrubunBFzX86fLZGmXsFZlHmPL9q+k 2jM= X-SBRS: 2.7 X-MesageID: 10482749 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,351,1571716800"; d="scan'208";a="10482749" From: Andrew Cooper To: Xen-devel Date: Tue, 24 Dec 2019 15:19:25 +0000 Message-ID: <20191224151932.6304-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191224151932.6304-1-andrew.cooper3@citrix.com> References: <20191224151932.6304-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 05/12] tools/migration: Drop IHDR_VERSION constant from libxc and python X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , =?utf-8?q?Marek_Marczykowski-?= =?utf-8?q?G=C3=B3recki?= , Wei Liu , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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 --- CC: Ian Jackson CC: Wei Liu CC: Marek Marczykowski-Górecki --- tools/libxc/xc_sr_restore.c | 6 +++--- tools/libxc/xc_sr_save.c | 2 +- tools/libxc/xc_sr_stream_format.h | 1 - tools/python/scripts/convert-legacy-stream | 6 +++--- tools/python/scripts/verify-stream-v2 | 2 +- tools/python/xen/migration/libxc.py | 9 ++++----- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c index 7872b71ab5..0280e55d4b 100644 --- a/tools/libxc/xc_sr_restore.c +++ b/tools/libxc/xc_sr_restore.c @@ -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; } diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c index 5467965b08..fa1a2e6c2a 100644 --- a/tools/libxc/xc_sr_save.c +++ b/tools/libxc/xc_sr_save.c @@ -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 = { diff --git a/tools/libxc/xc_sr_stream_format.h b/tools/libxc/xc_sr_stream_format.h index 37a7da6eab..ae7c0de393 100644 --- a/tools/libxc/xc_sr_stream_format.h +++ b/tools/libxc/xc_sr_stream_format.h @@ -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) diff --git a/tools/python/scripts/convert-legacy-stream b/tools/python/scripts/convert-legacy-stream index 2922fb3185..02a194178f 100755 --- a/tools/python/scripts/convert-legacy-stream +++ b/tools/python/scripts/convert-legacy-stream @@ -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 = "", help = "Legacy input to convert") parser.add_option("-o", "--out", dest = "fout", metavar = "", - 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") diff --git a/tools/python/scripts/verify-stream-v2 b/tools/python/scripts/verify-stream-v2 index 8bac04d566..fe82b86c11 100755 --- a/tools/python/scripts/verify-stream-v2 +++ b/tools/python/scripts/verify-stream-v2 @@ -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 = "", diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migration/libxc.py index 8a800df980..63b3558029 100644 --- a/tools/python/xen/migration/libxc.py +++ b/tools/python/xen/migration/libxc.py @@ -19,7 +19,6 @@ 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_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 @@ def verify_ihdr(self): 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" %