[libvirt] [PATCHv2 4/3] snapshot: make offline qemu snapshots atomic
Eric Blake
eblake at redhat.com
Mon Mar 19 21:25:11 UTC 2012
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 at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120319/645b2722/attachment-0001.sig>
More information about the libvir-list
mailing list