qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Issue with snapshot outside qcow2 disk - qemu 0.14.0


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] Issue with snapshot outside qcow2 disk - qemu 0.14.0
Date: Thu, 10 Mar 2011 09:27:00 +0000

On Thu, Mar 10, 2011 at 1:51 AM, SAURAV LAHIRI <address@hidden> wrote:
> Scenario 1:
> 1) I executed following with the vm in shutdown state.
> "#qemu-img snapshot -c snap1 /home/user1/lucid-vm2"

Here you are snapshotting the current disk image and storing the
snapshot away as "snap1".

> 2) Brought the VM Up.
>
> 3) Inside the vm create a file.
> #touch samplefile

Now you modified the current disk image but "snap1" remains unchanged.

> 4) Shutdown the vm and copy the snapshot outside the original qcow2
>
> #qemu-img convert -f qcow2 -O qcow2 -s snap1 /home/user1/lucid-vm2 
> /home/lucid-vm2-snap1
>
> Result : When I bring up the vm do not see the samplefile which is the 
> expected behaviour.

Are you bringing up the VM with lucid-vm2 (which should have
samplefile) or lucid-vm2-snap1 (which should not have samplefile)?

> Scenario 2:
> 1) I executed following with the vm in shutdown state.
> "#qemu-img snapshot -c snap1 /home/user1/lucid-vm2"
>
> 2) Bring up the VM.
>
> 3) Inside the vm create a file.
> #touch samplefile
>
> 4) VM is NOT Shutdown and copy the snapshot outside the original qcow2
>
> #qemu-img convert -f qcow2 -O qcow2 -s snap1 /home/user1/lucid-vm2 
> /home/lucid-vm2-snap1
>
> Result : When I bring up the vm do not see the samplefile which is the 
> expected behaviour.
>
>
> Is Scenario 2 safe where in the copying the snapshot outside the original 
> qcow2 is being executed with the VM running. This is because if this is safe 
> then this could be an approach as it would not require a long downtime for 
> the VM.

There is no guarantee that qemu-img will work on an image file that is
open by a running VM.

I have CCed Jes who has been working on a live snapshot mechanism.  He
recently added the snapshot_blkdev monitor command that takes a
snapshot of a block device while the VM is running.  A new image file
is created based off the original image file (which will no longer be
modified), all new disk writes go to the new image file.  It is safe
to perform read-only access to the original image file.  There
currently is no support to merge the snapshot changes back into the
original image while the VM is running, but I think that is the next
planned step.

If you can describe your snapshot use case at a higher level that
might be useful.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]