[virt-tools-list] [PATCH v3 6/6] Add tests for Virtuozzo hypervisor

Mikhail Feoktistov mfeoktistov at virtuozzo.com
Tue Feb 21 14:28:00 UTC 2017


UI and CLI tests
---
 tests/capabilities-xml/vz.xml                      | 53 ++++++++++++++++++++++
 .../compare/virt-install-vz-ct-template.xml        | 26 +++++++++++
 tests/clitest.py                                   | 15 ++++++
 tests/uitests/newvm.py                             | 23 ++++++++++
 tests/utils.py                                     |  1 +
 virtinst/uri.py                                    |  4 +-
 6 files changed, 121 insertions(+), 1 deletion(-)
 create mode 100644 tests/capabilities-xml/vz.xml
 create mode 100644 tests/cli-test-xml/compare/virt-install-vz-ct-template.xml

diff --git a/tests/capabilities-xml/vz.xml b/tests/capabilities-xml/vz.xml
new file mode 100644
index 0000000..fac68d9
--- /dev/null
+++ b/tests/capabilities-xml/vz.xml
@@ -0,0 +1,53 @@
+<capabilities>
+
+  <host>
+    <cpu>
+      <arch>x86_64</arch>
+      <model>IvyBridge</model>
+      <vendor>Intel</vendor>
+      <topology sockets="1" cores="4" threads="1"/>
+    </cpu>
+    <power_management/>
+    <topology>
+      <cells num="1">
+        <cell id="0">
+          <memory unit="KiB">16692408</memory>
+          <pages unit="KiB" size="4">4173102</pages>
+          <pages unit="KiB" size="2048">0</pages>
+          <distances>
+            <sibling id="0" value="10"/>
+          </distances>
+          <cpus num="4">
+            <cpu id="0" socket_id="0" core_id="0" siblings="0"/>
+            <cpu id="1" socket_id="0" core_id="1" siblings="1"/>
+            <cpu id="2" socket_id="0" core_id="2" siblings="2"/>
+            <cpu id="3" socket_id="0" core_id="3" siblings="3"/>
+          </cpus>
+        </cell>
+      </cells>
+    </topology>
+  </host>
+
+  <guest>
+    <os_type>exe</os_type>
+    <arch name="i686">
+      <wordsize>32</wordsize>
+      <emulator>vz</emulator>
+      <domain type="vz">
+        <emulator>vz</emulator>
+      </domain>
+    </arch>
+  </guest>
+
+  <guest>
+    <os_type>exe</os_type>
+    <arch name="x86_64">
+      <wordsize>64</wordsize>
+      <emulator>vz</emulator>
+      <domain type="vz">
+        <emulator>vz</emulator>
+      </domain>
+    </arch>
+  </guest>
+
+</capabilities>
diff --git a/tests/cli-test-xml/compare/virt-install-vz-ct-template.xml b/tests/cli-test-xml/compare/virt-install-vz-ct-template.xml
new file mode 100644
index 0000000..06fdc88
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-install-vz-ct-template.xml
@@ -0,0 +1,26 @@
+<domain type="vz">
+  <name>foobar</name>
+  <uuid>00000000-1111-2222-3333-444444444444</uuid>
+  <memory>65536</memory>
+  <currentMemory>65536</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch="x86_64">exe</type>
+    <init>/sbin/init</init>
+  </os>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <filesystem type="template">
+      <source name="centos-7-x86_64"/>
+      <target dir="/"/>
+    </filesystem>
+    <interface type="network">
+      <source network="Bridged"/>
+      <mac address="00:11:22:33:44:55"/>
+    </interface>
+    <graphics type="vnc" port="-1" keymap="en-us"/>
+    <console type="pty"/>
+  </devices>
+</domain>
diff --git a/tests/clitest.py b/tests/clitest.py
index 7b4e259..ade1b81 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -81,6 +81,7 @@ test_files = {
     'URI-KVM-S390X-KVMIBM' : utils.uri_kvm_s390x_KVMIBM,
     'URI-XEN': utils.uri_xen,
     'URI-LXC': utils.uri_lxc,
+    'URI-VZ': utils.uri_vz,
 
     'CLONE_DISK_XML'    : "%s/clone-disk.xml" % xmldir,
     'CLONE_STORAGE_XML' : "%s/clone-disk-managed.xml" % xmldir,
@@ -772,6 +773,20 @@ c.add_compare("--disk %(BLOCKVOL)s --cdrom %(EXISTIMG1)s --livecd --hvm", "xen-h
 
 
 
+#####################
+# VZ specific tests #
+#####################
+
+c = vinst.add_category("vz", "--connect %(URI-VZ)s --noautoconsole")
+c.add_compare(""" \
+--container \
+--filesystem type=template,source=centos-7-x86_64,target="/" \
+--network network="Bridged" \
+""", "vz-ct-template")
+
+
+
+
 #####################################
 # Device option back compat testing #
 #####################################
diff --git a/tests/uitests/newvm.py b/tests/uitests/newvm.py
index 83b4d67..cebbdb9 100644
--- a/tests/uitests/newvm.py
+++ b/tests/uitests/newvm.py
@@ -285,6 +285,29 @@ class NewVM(unittest.TestCase):
         self.assertFalse(newvm.showing)
         self.app.quit()
 
+
+    def testNewVMContainerVZ(self):
+        """
+        Virtuozzo container install
+        """
+        self.app.uri = tests.utils.uri_vz
+
+        newvm = self._open_create_wizard()
+        uiutils.find_fuzzy(newvm, "Container", "radio").click()
+        uiutils.find_fuzzy(newvm, "Forward", "button").click()
+
+        # Set directory path
+        uiutils.find_fuzzy(newvm, None,
+            "text", "container template").text = "centos-6-x86_64"
+        uiutils.find_fuzzy(newvm, "Forward", "button").click()
+        uiutils.find_fuzzy(newvm, "Forward", "button").click()
+        uiutils.find_fuzzy(newvm, "Finish", "button").click()
+
+        uiutils.find_fuzzy(self.app.root, "container1 on", "frame")
+        self.assertFalse(newvm.showing)
+        self.app.quit()
+
+
     def testNewXenPV(self):
         """
         Test the create wizard with a fake xen PV install
diff --git a/tests/utils.py b/tests/utils.py
index 013b305..64dfee4 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -54,6 +54,7 @@ uri_kvm_s390x_KVMIBM = (_uri_kvm_domcaps + _capsprefix + "kvm-s390x-KVMIBM.xml")
 
 uri_xen = uri_test + _capsprefix + "xen-rhel5.4.xml,xen"
 uri_lxc = uri_test + _capsprefix + "lxc.xml,lxc"
+uri_vz = uri_test + _capsprefix + "vz.xml,vz"
 
 
 def get_debug():
diff --git a/virtinst/uri.py b/virtinst/uri.py
index 3674726..2ea31d2 100644
--- a/virtinst/uri.py
+++ b/virtinst/uri.py
@@ -124,7 +124,7 @@ class MagicURI(object):
                      files in test/capabilities-xml/
         * 'domcaps=%s': Points to a file with domain capabilities XML, that
                         will be returned in conn.getDomainCapabilities
-        * qemu or xen or lxc: Fake the specified hypervisor
+        * qemu, xen, lxc or vz: Fake the specified hypervisor
 
     See tests/utils.py for example URLs
     """
@@ -161,6 +161,8 @@ class MagicURI(object):
             self.hv = "lxc"
         if pop_bool("xen"):
             self.hv = "xen"
+        if pop_bool("vz"):
+            self.hv = "vz"
 
         self.conn_version = opts.pop("connver", None)
         if self.conn_version:
-- 
2.9.3




More information about the virt-tools-list mailing list