File 083-virtinst-snapshot-add-memory-file-attribute.patch of Package virt-manager

Subject: virtinst: snapshot: add memory file attribute
From: Pavel Hrdina phrdina@redhat.com Tue Jan 23 12:06:54 2024 +0100
Date: Mon Mar 25 13:21:50 2024 +0100:
Git: d8565ac533c8b98476a841c00bd2397cb7aa8f90

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>

diff --git a/tests/data/xmlparse/change-snapshot-out.xml b/tests/data/xmlparse/change-snapshot-out.xml
index 33ec8578..ee9f41bc 100644
--- a/tests/data/xmlparse/change-snapshot-out.xml
+++ b/tests/data/xmlparse/change-snapshot-out.xml
@@ -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>
diff --git a/tests/test_xmlparse.py b/tests/test_xmlparse.py
index c81ca069..62e3d7aa 100644
--- a/tests/test_xmlparse.py
+++ b/tests/test_xmlparse.py
@@ -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")
diff --git a/virtinst/snapshot.py b/virtinst/snapshot.py
index cb32fc29..12a28ba1 100644
--- a/virtinst/snapshot.py
+++ b/virtinst/snapshot.py
@@ -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")
openSUSE Build Service is sponsored by