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

Reply via email to