]> xenbits.xensource.com Git - libvirt.git/commit
snapshot: only pass snapshot to qemu command line when reverting
authorEric Blake <eblake@redhat.com>
Thu, 25 Aug 2011 20:44:48 +0000 (14:44 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 25 Aug 2011 21:07:57 +0000 (15:07 -0600)
commit5e47785b852d3ab3ecc962e25ffde06f6f715a49
tree9ecbd67bc19f2fa6375c03d3edede8a12ded1e2c
parent861dc84bb5fdb34dad6cdb7482df26b82588c6b1
snapshot: only pass snapshot to qemu command line when reverting

Changing the current vm, and writing that change to the file
system, all before a new qemu starts, is risky; it's hard to
roll back if starting the new qemu fails for some reason.
Instead of abusing vm->current_snapshot and making the command
line generator decide whether the current snapshot warrants
using -loadvm, it is better to just directly pass a snapshot all
the way through the call chain if it is to be loaded.

This frees up the last use of snapshot->def->active for qemu's
use, so the next patch can repurpose that field for tracking
which snapshot is current.

* src/qemu/qemu_command.c (qemuBuildCommandLine): Don't use active
field of snapshot.
* src/qemu/qemu_process.c (qemuProcessStart): Add a parameter.
* src/qemu/qemu_process.h (qemuProcessStart): Update prototype.
* src/qemu/qemu_migration.c (qemuMigrationPrepareAny): Update
callers.
* src/qemu/qemu_driver.c (qemudDomainCreate)
(qemuDomainSaveImageStartVM, qemuDomainObjStart)
(qemuDomainRevertToSnapshot): Likewise.
(qemuDomainSnapshotSetCurrentActive)
(qemuDomainSnapshotSetCurrentInactive): Delete unused functions.
src/qemu/qemu_command.c
src/qemu/qemu_driver.c
src/qemu/qemu_migration.c
src/qemu/qemu_process.c
src/qemu/qemu_process.h