mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-09 06:50:22 +00:00
4201a7ea1c
Each <domainsnapshot> can now contain an optional <memory> element that describes how the VM state was handled, similar to disk snapshots. The new element will always appear in output; for back-compat, an input that lacks the element will assume 'no' or 'internal' according to the domain state. Along with this change, it is now possible to pass <disks> in the XML for an offline snapshot; this also needs to be wired up in a future patch, to make it possible to choose internal vs. external on a per-disk basis for each disk in an offline domain. At that point, using the --disk-only flag for an offline domain will be able to work. For some examples below, remember that qemu supports the following snapshot actions: qemu-img: offline external and internal disk savevm: online internal VM and disk migrate: online external VM transaction: online external disk ===== <domainsnapshot> <memory snapshot='no'/> ... </domainsnapshot> implies that there is no VM state saved (mandatory for offline and disk-only snapshots, not possible otherwise); using qemu-img for offline domains and transaction for online. ===== <domainsnapshot> <memory snapshot='internal'/> ... </domainsnapshot> state is saved inside one of the disks (as in qemu's 'savevm' system checkpoint implementation). If needed in the future, we can also add an attribute pointing out _which_ disk saved the internal state; maybe disk='vda'. ===== <domainsnapshot> <memory snapshot='external' file='/path/to/state'/> ... </domainsnapshot> This is not wired up yet, but future patches will allow this to control a combination of 'virsh save /path/to/state' plus disk snapshots from the same point in time. ===== So for 1.0.1 (and later, as needed), I plan to implement this table of combinations, with '*' designating new code and '+' designating existing code reached through new combinations of xml and/or the existing DISK_ONLY flag: domain memory disk disk-only | result ----------------------------------------- offline omit omit any | memory=no disk=int, via qemu-img offline no omit any |+memory=no disk=int, via qemu-img offline omit/no no any | invalid combination (nothing to snapshot) offline omit/no int any |+memory=no disk=int, via qemu-img offline omit/no ext any |*memory=no disk=ext, via qemu-img offline int/ext any any | invalid combination (no memory to save) online omit omit off | memory=int disk=int, via savevm online omit omit on | memory=no disk=default, via transaction online omit no/ext off | unsupported for now online omit no on | invalid combination (nothing to snapshot) online omit ext on | memory=no disk=ext, via transaction online omit int off |+memory=int disk=int, via savevm online omit int on | unsupported for now online no omit any |+memory=no disk=default, via transaction online no no any | invalid combination (nothing to snapshot) online no int any | unsupported for now online no ext any |+memory=no disk=ext, via transaction online int/ext any on | invalid combination (disk-only vs. memory) online int omit off |+memory=int disk=int, via savevm online int no/ext off | unsupported for now online int int off |+memory=int disk=int, via savevm online ext omit off |*memory=ext disk=default, via migrate+trans online ext no off |+memory=ext disk=no, via migrate online ext int off | unsupported for now online ext ext off |*memory=ext disk=ext, via migrate+transaction * docs/schemas/domainsnapshot.rng (memory): New RNG element. * docs/formatsnapshot.html.in: Document it. * src/conf/snapshot_conf.h (virDomainSnapshotDef): New fields. * src/conf/domain_conf.c (virDomainSnapshotDefFree) (virDomainSnapshotDefParseString, virDomainSnapshotDefFormat): Manage new fields. * tests/domainsnapshotxml2xmltest.c: New test. * tests/domainsnapshotxml2xmlin/*.xml: Update existing tests. * tests/domainsnapshotxml2xmlout/*.xml: Likewise.
154 lines
3.9 KiB
XML
154 lines
3.9 KiB
XML
<?xml version="1.0"?>
|
|
<!-- A Relax NG schema for the libvirt domain snapshot properties XML format -->
|
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
|
<start>
|
|
<ref name='domainsnapshot'/>
|
|
</start>
|
|
|
|
<include href='domaincommon.rng'/>
|
|
|
|
<define name='domainsnapshot'>
|
|
<element name='domainsnapshot'>
|
|
<interleave>
|
|
<optional>
|
|
<element name='name'>
|
|
<text/>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<element name='description'>
|
|
<text/>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<element name='state'>
|
|
<ref name='state'/>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<element name='creationTime'>
|
|
<text/>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<element name='memory'>
|
|
<choice>
|
|
<attribute name='snapshot'>
|
|
<choice>
|
|
<value>no</value>
|
|
<value>internal</value>
|
|
</choice>
|
|
</attribute>
|
|
<group>
|
|
<optional>
|
|
<attribute name='snapshot'>
|
|
<value>external</value>
|
|
</attribute>
|
|
</optional>
|
|
<attribute name='file'>
|
|
<ref name='absFilePath'/>
|
|
</attribute>
|
|
</group>
|
|
</choice>
|
|
<empty/>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<element name='disks'>
|
|
<zeroOrMore>
|
|
<ref name='disksnapshot'/>
|
|
</zeroOrMore>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<element name='active'>
|
|
<choice>
|
|
<value>0</value>
|
|
<value>1</value>
|
|
</choice>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<choice>
|
|
<element name='domain'>
|
|
<element name='uuid'>
|
|
<ref name="UUID"/>
|
|
</element>
|
|
</element>
|
|
<ref name='domain'/>
|
|
</choice>
|
|
</optional>
|
|
<optional>
|
|
<element name='parent'>
|
|
<element name='name'>
|
|
<text/>
|
|
</element>
|
|
</element>
|
|
</optional>
|
|
</interleave>
|
|
</element>
|
|
</define>
|
|
|
|
<define name='state'>
|
|
<choice>
|
|
<value>nostate</value>
|
|
<value>running</value>
|
|
<value>blocked</value>
|
|
<value>paused</value>
|
|
<value>shutdown</value>
|
|
<value>shutoff</value>
|
|
<value>crashed</value>
|
|
<value>disk-snapshot</value>
|
|
</choice>
|
|
</define>
|
|
|
|
<define name='disksnapshot'>
|
|
<element name='disk'>
|
|
<attribute name='name'>
|
|
<choice>
|
|
<ref name='diskTarget'/>
|
|
<ref name='absFilePath'/>
|
|
</choice>
|
|
</attribute>
|
|
<choice>
|
|
<attribute name='snapshot'>
|
|
<value>no</value>
|
|
</attribute>
|
|
<attribute name='snapshot'>
|
|
<value>internal</value>
|
|
</attribute>
|
|
<group>
|
|
<optional>
|
|
<attribute name='snapshot'>
|
|
<value>external</value>
|
|
</attribute>
|
|
</optional>
|
|
<interleave>
|
|
<optional>
|
|
<element name='driver'>
|
|
<optional>
|
|
<attribute name='type'>
|
|
<ref name='diskFormat'/>
|
|
</attribute>
|
|
</optional>
|
|
<empty/>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<element name='source'>
|
|
<optional>
|
|
<attribute name='file'>
|
|
<ref name='absFilePath'/>
|
|
</attribute>
|
|
</optional>
|
|
<empty/>
|
|
</element>
|
|
</optional>
|
|
</interleave>
|
|
</group>
|
|
</choice>
|
|
</element>
|
|
</define>
|
|
|
|
</grammar>
|