From patchwork Wed Apr 23 16:37:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 341931 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3D23A14009F for ; Thu, 24 Apr 2014 02:45:04 +1000 (EST) Received: from localhost ([::1]:33854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd0I9-0002jP-SO for incoming@patchwork.ozlabs.org; Wed, 23 Apr 2014 12:45:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd0Bt-0003NA-9w for qemu-devel@nongnu.org; Wed, 23 Apr 2014 12:38:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wd0Bl-0008H3-Pt for qemu-devel@nongnu.org; Wed, 23 Apr 2014 12:38:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd0Bl-0008Gi-Hs for qemu-devel@nongnu.org; Wed, 23 Apr 2014 12:38:25 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3NGcLAZ012829 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Apr 2014 12:38:21 -0400 Received: from dgilbert-t530.home.treblig.org (vpn1-7-213.ams2.redhat.com [10.36.7.213]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3NGboL3024273; Wed, 23 Apr 2014 12:38:19 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 23 Apr 2014 17:37:46 +0100 Message-Id: <1398271069-22057-14-git-send-email-dgilbert@redhat.com> In-Reply-To: <1398271069-22057-1-git-send-email-dgilbert@redhat.com> References: <1398271069-22057-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: stefanb@linux.vnet.ibm.com, quintela@redhat.com, mdroth@linux.vnet.ibm.com, agraf@suse.de, mst@redhat.com, aliguori@amazon.com, afaerber@suse.de Subject: [Qemu-devel] [RFC PATCH v2 13/16] Start some BER format docs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Dr. David Alan Gilbert" Add information on the QEMUFile/Visitor/VMState split Describe how to verify a BER stream against the schema Signed-off-by: Dr. David Alan Gilbert --- docs/migration.txt | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/migration.txt b/docs/migration.txt index 0e0a1d4..894abf3 100644 --- a/docs/migration.txt +++ b/docs/migration.txt @@ -48,8 +48,17 @@ This is used for RAM and block devices. It is not yet ported to vmstate. === What is the common infrastructure === -QEMU uses a QEMUFile abstraction to be able to do migration. Any type -of migration that wants to use QEMU infrastructure has to create a +Migration consists of a number of layers that handle different parts of the +problem: + QEMUFile - Buffering/reading/writing data without worrying about it's + contents. Versions exist for file I/O, sockets, RDMA and + to put data into a QEMU Block device. + Visitor - Visitors format data onto the QEMUFile. A binary format and + a BER format currently exist. + VMState - Represent the structure of the data for a given device with + support for versioning. + +Any type of migration that wants to use QEMU infrastructure has to create a QEMUFile with: QEMUFile *qemu_fopen_ops(void *opaque, @@ -296,3 +305,24 @@ save/send this state when we are in the middle of a pio operation (that is what ide_drive_pio_state_needed() checks). If DRQ_STAT is not enabled, the values on that fields are garbage and don't need to be sent. + +ASN.1/BER format migration +========================== + +In BER format migration the migration stream is described by an ASN.1 schema +(that's defined in docs/specs/migration.schema). + +The 'asn1c' program can be used to validate a migration stream against the schema + - although it'll probably use a lot of memory doing it - so it's best to do it +with a small RAM image. + +To validate an image against the schema: + a) Make a temporary directory and cd into it + b) asn1c -fcompound-names /path/to/migration.schema + c) make -f Makefile.am.sample CFLAGS+="-DPDU=QemuFile -DEMIT_ASN_DEBUG=1 -I." + d) ./progname -iber log.ber -d 2> debug > decoding + + If it's happy the 'decoding' output should be an XML like dump of the input file; +if it's not happy, the debug file might help you find out why (Search backwards +from the end for the first 'Freeing' to find the point at which it detected something +bad).