* [Qemu-devel] Running read-only internal snapshot (loadvm)
@ 2015-01-21 11:53 Jarkko Turkulainen
2015-01-22 11:55 ` Stefan Hajnoczi
0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Turkulainen @ 2015-01-21 11:53 UTC (permalink / raw)
To: qemu-devel; +Cc: stefanha
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
Hello,
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.
[-- Attachment #2: Type: text/html, Size: 545 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] Running read-only internal snapshot (loadvm)
2015-01-21 11:53 [Qemu-devel] Running read-only internal snapshot (loadvm) Jarkko Turkulainen
@ 2015-01-22 11:55 ` Stefan Hajnoczi
2015-01-22 14:41 ` Jarkko Turkulainen
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2015-01-22 11:55 UTC (permalink / raw)
To: Jarkko Turkulainen; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]
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 #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] Running read-only internal snapshot (loadvm)
2015-01-22 11:55 ` Stefan Hajnoczi
@ 2015-01-22 14:41 ` Jarkko Turkulainen
0 siblings, 0 replies; 3+ messages in thread
From: Jarkko Turkulainen @ 2015-01-22 14:41 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel
> Instead of qcow2 internal snapshots, you could look at migrating to file:
This works perfectly! Now I can put my master image and also the state
file read-only, and do -snapshot to redirect changes to temp-file.
Nice.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-22 14:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 11:53 [Qemu-devel] Running read-only internal snapshot (loadvm) Jarkko Turkulainen
2015-01-22 11:55 ` Stefan Hajnoczi
2015-01-22 14:41 ` Jarkko Turkulainen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.