[virt-tools-list] [virt-manager PATCH] cloner: get original XML with security informations

Pavel Hrdina phrdina at redhat.com
Fri Sep 15 16:59:47 UTC 2017


Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1455491

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 tests/clone-xml/graphics-password-in.xml  | 23 +++++++++++++++++++++++
 tests/clone-xml/graphics-password-out.xml | 23 +++++++++++++++++++++++
 tests/clonetest.py                        |  4 ++++
 virtinst/cloner.py                        |  3 ++-
 4 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 tests/clone-xml/graphics-password-in.xml
 create mode 100644 tests/clone-xml/graphics-password-out.xml

diff --git a/tests/clone-xml/graphics-password-in.xml b/tests/clone-xml/graphics-password-in.xml
new file mode 100644
index 00000000..13b14dd6
--- /dev/null
+++ b/tests/clone-xml/graphics-password-in.xml
@@ -0,0 +1,23 @@
+<domain type='kvm'>
+  <name>clone-orig</name>
+  <uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
+  <memory>262144</memory>
+  <currentMemory>262144</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='cdrom'/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-kvm</emulator>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='foo'/>
+  </devices>
+</domain>
diff --git a/tests/clone-xml/graphics-password-out.xml b/tests/clone-xml/graphics-password-out.xml
new file mode 100644
index 00000000..e730efef
--- /dev/null
+++ b/tests/clone-xml/graphics-password-out.xml
@@ -0,0 +1,23 @@
+<domain type="kvm">
+  <name>clone-new</name>
+  <uuid>12345678-1234-1234-1234-123456789012</uuid>
+  <memory>262144</memory>
+  <currentMemory>262144</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch="i686" machine="pc">hvm</type>
+    <boot dev="cdrom"/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset="utc"/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-kvm</emulator>
+    <input type="mouse" bus="ps2"/>
+    <graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1" passwd="foo"/>
+  </devices>
+</domain>
diff --git a/tests/clonetest.py b/tests/clonetest.py
index 68ad803d..3546be01 100644
--- a/tests/clonetest.py
+++ b/tests/clonetest.py
@@ -187,3 +187,7 @@ class TestClone(unittest.TestCase):
     def testCloneNvramNewpool(self):
         base = "nvram-newpool"
         self._clone_helper(base)
+
+    def testCloneGraphicsPassword(self):
+        base = "graphics-password"
+        self._clone_helper(base)
diff --git a/virtinst/cloner.py b/virtinst/cloner.py
index 93ddbeec..72642f60 100644
--- a/virtinst/cloner.py
+++ b/virtinst/cloner.py
@@ -282,7 +282,8 @@ class Cloner(object):
 
         if self.original_guest is not None and not self.original_xml:
             self.original_dom = self._lookup_vm(self.original_guest)
-            self.original_xml = self.original_dom.XMLDesc(0)
+            flags = libvirt.VIR_DOMAIN_XML_SECURE
+            self.original_xml = self.original_dom.XMLDesc(flags)
 
         logging.debug("Original XML:\n%s", self.original_xml)
 
-- 
2.13.5




More information about the virt-tools-list mailing list