mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
snapshot: allow full domain xml in snapshot
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. Later patches will actually supply a full domain; for now, this wires up the storage to support one, but doesn't ever generate one in dumpxml output. Happily, libvirt.c was already rejecting use of VIR_DOMAIN_XML_SECURE from read-only connections, even though before this patch, there was no information to be secured by the use of that flag. And while we're at it, mark the libvirt snapshot metadata files as internal-use only. * src/libvirt.c (virDomainSnapshotGetXMLDesc): Document flag. * src/conf/domain_conf.h (_virDomainSnapshotDef): Add member. (virDomainSnapshotDefParseString, virDomainSnapshotDefFormat): Update signature. * src/conf/domain_conf.c (virDomainSnapshotDefFree): Clean up. (virDomainSnapshotDefParseString): Optionally parse domain. (virDomainSnapshotDefFormat): Output full domain. * src/esx/esx_driver.c (esxDomainSnapshotCreateXML) (esxDomainSnapshotGetXMLDesc): Update callers. * src/vbox/vbox_tmpl.c (vboxDomainSnapshotCreateXML) (vboxDomainSnapshotGetXMLDesc): Likewise. * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML) (qemuDomainSnapshotLoad, qemuDomainSnapshotGetXMLDesc) (qemuDomainSnapshotWriteMetadata): Likewise. * docs/formatsnapshot.html.in: Rework doc example. Based on a patch by Philipp Hahn.
This commit is contained in:
@@ -63,18 +63,33 @@
|
||||
snapshots, as described above. Readonly.
|
||||
</dd>
|
||||
<dt><code>domain</code></dt>
|
||||
<dd>The domain that this snapshot was taken against. This
|
||||
element contains exactly one child element, uuid. This
|
||||
specifies the uuid of the domain that this snapshot was taken
|
||||
against. Readonly.
|
||||
<dd>The domain that this snapshot was taken against. Older
|
||||
versions of libvirt stored only a single child element, uuid;
|
||||
reverting to a snapshot like this is risky if the current
|
||||
state of the domain differs from the state that the domain was
|
||||
created in, and requires the use of the
|
||||
<code>VIR_DOMAIN_SNAPSHOT_REVERT_FORCE</code> flag
|
||||
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 (<span class="since">since
|
||||
0.9.5</span>). Readonly.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a name="example">Example</a></h2>
|
||||
<h2><a name="example">Examples</a></h2>
|
||||
|
||||
<p>Using this XML on creation:</p>
|
||||
<pre>
|
||||
<domainsnapshot>
|
||||
<name>os-updates</name>
|
||||
<description>Snapshot of OS install and updates</description>
|
||||
</domainsnapshot></pre>
|
||||
|
||||
<p>will result in XML similar to this from
|
||||
virDomainSnapshotGetXMLDesc:</p>
|
||||
<pre>
|
||||
<domainsnapshot>
|
||||
<name>1270477159</name>
|
||||
<description>Snapshot of OS install and updates</description>
|
||||
<state>running</state>
|
||||
<creationTime>1270477159</creationTime>
|
||||
@@ -82,7 +97,11 @@
|
||||
<name>bare-os-install</name>
|
||||
</parent>
|
||||
<domain>
|
||||
<name>fedora</name>
|
||||
<uuid>93a5c045-6457-2c09-e56c-927cdf34e178</uuid>
|
||||
<memory>1048576</memory>
|
||||
...
|
||||
</devices>
|
||||
</domain>
|
||||
</domainsnapshot></pre>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user