From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SA1Cn-00073A-KE for qemu-devel@nongnu.org; Tue, 20 Mar 2012 11:42:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SA1CK-0005pG-BI for qemu-devel@nongnu.org; Tue, 20 Mar 2012 11:42:36 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:36679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SA1CK-0005oc-3X for qemu-devel@nongnu.org; Tue, 20 Mar 2012 11:42:08 -0400 Received: by wibhr17 with SMTP id hr17so226536wib.10 for ; Tue, 20 Mar 2012 08:42:05 -0700 (PDT) Date: Tue, 20 Mar 2012 15:42:02 +0000 From: Stefan Hajnoczi Message-ID: <20120320154202.GA896@stefanha-thinkpad.localdomain> References: <1331055149-10982-1-git-send-email-benoit.canet@gmail.com> <1331055149-10982-9-git-send-email-benoit.canet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1331055149-10982-9-git-send-email-benoit.canet@gmail.com> Subject: Re: [Qemu-devel] [RFC PATCH 08/10] qed: add bdrv_post_incoming_migration operation checking the image List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, wolf@redhat.com, stefanha@linux.vnet.ibm.com On Tue, Mar 06, 2012 at 06:32:27PM +0100, Benoît Canet wrote: > @@ -1529,6 +1529,19 @@ static int bdrv_qed_change_backing_file(BlockDriverState *bs, > return ret; > } > > +static void bdrv_qed_check_if_needed(BlockDriverState *bs) > +{ > + /* close the block device if the verification fail */ > + if (check_image_if_needed(bs)) { > + bdrv_close(bs); > + } We open the image for incoming migration while the VM is still running. That means the metadata and header can still change before migration switchover. So we need to drop everything we know about this image and start from scratch. qcow2 does it like this: qcow2_close(bs); memset(s, 0, sizeof(BDRVQcowState)); qcow2_open(bs, flags); We should do something similar so that the QED header is re-read. This probably means check_image_if_needed() doesn't need to be factored out of qed_open(). (Note that the underlying file and BlockDriverState don't get reopened, we're simply reinitializing the QED/QCOW2 image format layer here.) Stefan