virtinst: snapshot: add memory file attribute

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2024-01-23 12:06:54 +01:00 committed by Pavel Hrdina
parent 3cde1acbb6
commit d8565ac533
3 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ newline
<name>newparent</name>
</parent>
<creationTime>1234</creationTime>
<memory snapshot="internal"/>
<memory snapshot="external" file="/some/path/to/memory.img"/>
<disks>
<disk name="hdb" snapshot="no"/>
</disks>

View File

@ -699,7 +699,8 @@ def testChangeSnapshot():
check("description", "offline desk", "foo\nnewline\n indent")
check("parent", "offline-root", "newparent")
check("creationTime", 1375905916, 1234)
check("memory_type", "no", "internal")
check("memory_type", "no", "external")
check("memory_file", None, "/some/path/to/memory.img")
check = _make_checker(snap.disks[0])
check("name", "hda", "hdb")

View File

@ -4,6 +4,7 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
from .devices.disk import _DiskSource
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
@ -11,6 +12,7 @@ class _SnapshotDisk(XMLBuilder):
XML_NAME = "disk"
name = XMLProperty("./@name")
snapshot = XMLProperty("./@snapshot")
source = XMLChildProperty(_DiskSource, is_single=True)
class DomainSnapshot(XMLBuilder):
@ -24,5 +26,6 @@ class DomainSnapshot(XMLBuilder):
parent = XMLProperty("./parent/name")
memory_type = XMLProperty("./memory/@snapshot")
memory_file = XMLProperty("./memory/@file")
disks = XMLChildProperty(_SnapshotDisk, relative_xpath="./disks")