qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Running read-only internal snapshot (loadvm)


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] Running read-only internal snapshot (loadvm)
Date: Thu, 22 Jan 2015 11:55:50 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Jan 21, 2015 at 01:53:15PM +0200, Jarkko Turkulainen wrote:
> Is it possible to do -loadvm with a read-only image? What I'm trying to do
> is running already booted OS but discarding all the changes. So basically,
> I'd like to combine -loadvm and -snapshot. The image needs to be read-only
> because there are multiple simultaneous instances running. As a workaround,
> I've been doing the -loadvm on a temporary copy of the image, but that is
> not really effective, it takes time (or memory) to copy the image around.

If the host file system supports reflink then cp(1) can make a cheap
(shared) copy.  See the cp(1) man page.

I looked at QEMU's load_vmstate() function, which is used to load an
internal snapshot.

Unfortunately it checks that the drive is writable since loading a qcow2
internal snapshot involves writes to the image file.

Instead of qcow2 internal snapshots, you could look at migrating to
file:

1. Create the master image by migrating to file:
   
http://www.linux-kvm.org/page/Migration#savevm.2Floadvm_to_an_external_state_file_.28using_pseudo-migration.29

2. Instantiate a new guest:
   qemu -incoming 'exec:gzip -d master.vmstate.gz' \
        -drive if=virtio,snapshot=on,file=master.img,format=raw \
        ...

I haven't tested it or looked for the optimal syntax/sequence of
commands.  Still, I think that's your best bet.

Stefan

Attachment: pgpkzT6VWxOvV.pgp
Description: PGP signature


reply via email to

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