[libvirt] [PATCHv2 23/26] snapshot: store qemu domain details in xml
Eric Blake
eblake at redhat.com
Thu Aug 18 19:01:24 UTC 2011
On 08/15/2011 05:33 PM, Eric Blake wrote:
> When reverting to a snapshot, the inactive domain configuration
> has to be rolled back to what it was at the time of the snapshot.
> Additionally, if the VM is active and the snapshot was active,
> this now adds a failure if the two configurations are ABI
> incompatible, rather than risking qemu confusion.
>
> @@ -8703,6 +8704,15 @@ static virDomainSnapshotPtr qemuDomainSnapshotCreateXML(virDomainPtr domain,
> vm->current_snapshot = NULL;
> }
>
> + /* Easiest way to clone inactive portion of vm->def is via
> + * conversion in and back out of xml. */
> + if (!(xml = virDomainDefFormat(vm->def, (VIR_DOMAIN_XML_INACTIVE |
> + VIR_DOMAIN_XML_SECURE))) ||
> + !(def->dom = virDomainDefParseString(driver->caps, xml,
> + QEMU_EXPECTED_VIRT_TYPES,
> + VIR_DOMAIN_XML_INACTIVE)))
After my v3 patch 5/26, def is now NULL at this point, and this needs to
be squashed in:
diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index 6049f57..0f162fb 100644
--- i/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -8713,9 +8713,9 @@ static virDomainSnapshotPtr
qemuDomainSnapshotCreateXML(virDomainPtr domain,
* conversion in and back out of xml. */
if (!(xml = virDomainDefFormat(vm->def, (VIR_DOMAIN_XML_INACTIVE |
VIR_DOMAIN_XML_SECURE))) ||
- !(def->dom = virDomainDefParseString(driver->caps, xml,
- QEMU_EXPECTED_VIRT_TYPES,
- VIR_DOMAIN_XML_INACTIVE)))
+ !(snap->def->dom = virDomainDefParseString(driver->caps, xml,
+
QEMU_EXPECTED_VIRT_TYPES,
+
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
/* actually do the snapshot */
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list