[Kimchi-devel] [PATCH v3 4/4] Add a new test case for pci hotplug on Power

Jose Ricardo Ziviani joserz at linux.vnet.ibm.com
Mon Jul 13 14:47:33 UTC 2015


 - From now on all templates are created with xhci usb controller, so a
   hotplug must be performed flawlessly. If anything wrong the test case
   will fail.

Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>
---
 tests/test_model.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/tests/test_model.py b/tests/test_model.py
index 3828342..896e29b 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -1205,6 +1205,33 @@ class ModelTests(unittest.TestCase):
         # remove files creates
         inst.repository_delete(repo_id)
 
+    def _host_is_PKVM():
+        import platform
+        distro, _, _ = platform.linux_distribution()
+        return distro == 'IBM_PowerKVM'
+
+    @unittest.skipUnless(_host_is_PKVM(), 'Only required for PowerKVM host')
+    def test_pci_hotplug_requires_xhci_usb_controller(self):
+        config.set("authentication", "method", "pam")
+        inst = model.Model(None, objstore_loc=self.tmp_store)
+        tpl_params = {'name': 'test', 'memory': 1024, 'cdrom': UBUNTU_ISO}
+        inst.templates_create(tpl_params)
+
+        with RollbackContext() as rollback:
+            vm_params = {'name': 'kimchi-vm1', 'template': '/templates/test'}
+            task1 = inst.vms_create(vm_params)
+            inst.task_wait(task1['id'])
+            rollback.prependDefer(utils.rollback_wrapper, inst.vm_delete,
+                                  'kimchi-vm1')
+            # Start vm
+            inst.vm_start('kimchi-vm1')
+            rollback.prependDefer(utils.rollback_wrapper, inst.vm_poweroff,
+                                  'kimchi-vm1')
+
+            # check if create VM has USB XHCI controller
+            self.assertTrue(
+                inst.vmhostdevs_have_xhci_usb_controller('kimchi-vm1'))
+
 
 class BaseModelTests(unittest.TestCase):
     class FoosModel(object):
-- 
1.9.1




More information about the Kimchi-devel mailing list