On 09/01/2011 10:25 PM, Eric Blake wrote:
Just like VM saved state images (virsh save), snapshots MUST
track the inactive domain xml to detect any ABI incompatibilities.
The indentation is not perfect, but functionality comes before form.
@@ -1638,6 +1641,12 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
_("failed to create snapshot file '%s'"),
snapFile);
goto cleanup;
}
+ /* XXX need virsh snapshot-edit, before this makes sense:
+ * char *tmp;
+ * virAsprintf(&tmp, "snapshot-edit %s", vm->def->name);
+ * virEmitXMLWarning(fd, snapshot->def->name, tmp);
+ * VIR_FREE(tmp);
+ */
Turns out I've implemented snapshot-edit earlier in the series, so
squashing this in:
diff --git i/docs/formatsnapshot.html.in w/docs/formatsnapshot.html.in
index 2fe9e4d..91799b4 100644
--- i/docs/formatsnapshot.html.in
+++ w/docs/formatsnapshot.html.in
@@ -72,7 +72,8 @@
in <code>virDomainRevertToSnapshot()</code>. Newer versions
of libvirt store the entire
inactive <a href="formatdomain.html">domain
configuration</a>
- at the time of the snapshot. Readonly.
+ at the time of the snapshot (<span class="since">since
+ 0.9.5</span>). Readonly.
</dd>
</dl>
diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index 17b97eb..a1557b1 100644
--- i/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -1612,6 +1612,7 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
char *snapDir = NULL;
char *snapFile = NULL;
char uuidstr[VIR_UUID_STRING_BUFLEN];
+ char *tmp;
virUUIDFormat(vm->def->uuid, uuidstr);
newxml = virDomainSnapshotDefFormat(uuidstr, snapshot->def,
@@ -1641,12 +1642,14 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
_("failed to create snapshot file '%s'"),
snapFile);
goto cleanup;
}
- /* XXX need virsh snapshot-edit, before this makes sense:
- * char *tmp;
- * virAsprintf(&tmp, "snapshot-edit %s", vm->def->name);
- * virEmitXMLWarning(fd, snapshot->def->name, tmp);
- * VIR_FREE(tmp);
- */
+
+ if (virAsprintf(&tmp, "snapshot-edit %s", vm->def->name) < 0)
{
+ virReportOOMError();
+ goto cleanup;
+ }
+ virEmitXMLWarning(fd, snapshot->def->name, tmp);
+ VIR_FREE(tmp);
+
if (safewrite(fd, newxml, strlen(newxml)) != strlen(newxml)) {
virReportSystemError(errno, _("Failed to write snapshot data
to %s"),
snapFile);
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org