On 03/19/2012 07:40 AM, Peter Krempa wrote:
On 03/17/2012 05:33 PM, Eric Blake wrote:
> Offline internal snapshots can be rolled back with just a little
> bit of refactoring, meaning that we are now automatically atomic.
>
> * src/qemu/qemu_domain.c (qemuDomainSnapshotForEachQcow2): Move
> guts...
> (qemuDomainSnapshotForEachQcow2Raw): ...to new helper, to allow
> rollbacks.
> * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Offline
> snapshots are now atomic.
> ---
You rollback changes to disks if other disks are not snapshotable, but later on,
when the actual qemu-img command is run and fails the rollback is not performed.
Good catch.
I's suggest squashing in:
if (virRun(qemuimgarg, NULL) < 0) {
if (try_all) {
VIR_WARN("skipping snapshot action on %s",
def->disks[i]->dst);
skipped = true;
continue;
+ } else if (STREQ(op, "-c") && i) {
+ /* We must roll back partial creation by deleting
+ * all earlier snapshots. */
+ qemuDomainSnapshotForEachQcow2Raw(driver, def, name,
+ "-d", false, i);
}
Yep, that looks right. Thanks for the test case.
Otherwise looks good. ACK with that suggested change.
Same story as for 3/3 - I'll wait to push this until I've run a few more
tests for the rest of my pending series, in case I find any more
last-minute issues.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org