From nobody Thu Apr 18 11:24:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1489183652563205.78373922699632; Fri, 10 Mar 2017 14:07:32 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 80F1782063D; Fri, 10 Mar 2017 22:07:30 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id 1E24D8205D8 for ; Fri, 10 Mar 2017 22:06:29 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2AM4E9I066803 for ; Fri, 10 Mar 2017 17:06:28 -0500 Received: from e24smtp01.br.ibm.com (e24smtp01.br.ibm.com [32.104.18.85]) by mx0a-001b2d01.pphosted.com with ESMTP id 293p3b67uk-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 10 Mar 2017 17:06:28 -0500 Received: from localhost by e24smtp01.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Mar 2017 19:06:25 -0300 Received: from d24relay04.br.ibm.com (9.18.232.146) by e24smtp01.br.ibm.com (10.172.0.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 10 Mar 2017 19:06:22 -0300 Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v2AM6M6I32047198 for ; Fri, 10 Mar 2017 19:06:22 -0300 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v2AM6LlL018211 for ; Fri, 10 Mar 2017 19:06:21 -0300 Received: from t440.ibm.com ([9.80.210.122]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v2AM6BKA018086; Fri, 10 Mar 2017 19:06:20 -0300 X-Original-To: kimchi-devel@ovirt.org From: Lucio Correia To: Kimchi Devel Date: Fri, 10 Mar 2017 19:06:07 -0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489183571-10933-1-git-send-email-luciojhc@linux.vnet.ibm.com> References: <1489183571-10933-1-git-send-email-luciojhc@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17031022-1523-0000-0000-00000288ED70 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17031022-1524-0000-0000-00002A1F05F3 Message-Id: <1489183571-10933-5-git-send-email-luciojhc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-10_15:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703100171 Subject: [Kimchi-devel] [PATCH] [Kimchi 4/8] Use "qemu:///session" as test_model libvirt uri X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lucio Correia --- tests/test_model.py | 59 +++++++++++++++++++------------------------------= ---- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/tests/test_model.py b/tests/test_model.py index 64085a0..78c291e 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -164,16 +164,6 @@ def get_remote_iso_path(): return remote_path =20 =20 -def _setDiskPoolDefault(): - osinfo.defaults['disks'][0]['pool'] =3D { - 'name': '/plugins/kimchi/storagepools/default'} - - -def _setDiskPoolDefaultTest(): - osinfo.defaults['disks'][0]['pool'] =3D { - 'name': '/plugins/kimchi/storagepools/default-pool'} - - class ModelTests(unittest.TestCase): def setUp(self): self.tmp_store =3D '/tmp/kimchi-store-test' @@ -181,7 +171,7 @@ class ModelTests(unittest.TestCase): def tearDown(self): # FIXME: Tests using 'test:///default' URI should be moved to # test_rest or test_mockmodel to avoid overriding problems - LibvirtConnection._connections['test:///default'] =3D {} + LibvirtConnection._connections['qemu:///session'] =3D {} =20 if os.path.isfile(self.tmp_store): os.unlink(self.tmp_store) @@ -1120,7 +1110,7 @@ class ModelTests(unittest.TestCase): =20 def test_vm_memory_hotplug(self): config.set("authentication", "method", "pam") - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) orig_params =3D {'name': 'test', 'memory': {'current': 1024, 'maxmemory': 4096 @@ -1226,7 +1216,7 @@ class ModelTests(unittest.TestCase): @unittest.skipUnless(('ppc64' in os.uname()[4]), msg) def test_non_numa_vm_memory_hotplug(self): config.set("authentication", "method", "pam") - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) conn =3D inst.conn.get() vm =3D 'non-numa-kimchi-test' =20 @@ -1471,21 +1461,21 @@ class ModelTests(unittest.TestCase): xml =3D """\ \ """ - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) self.assertEqual('2', inst.vm_get_vm_cpu_cores(xml)) =20 def test_get_vm_cpu_sockets(self): xml =3D """\ \ """ - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) self.assertEqual('3', inst.vm_get_vm_cpu_sockets(xml)) =20 def test_get_vm_cpu_threads(self): xml =3D """\ \ """ - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) self.assertEqual('8', inst.vm_get_vm_cpu_threads(xml)) =20 @mock.patch('wok.plugins.kimchi.model.vms.VMModel.has_topology') @@ -1502,7 +1492,7 @@ class ModelTests(unittest.TestCase): mock_has_topology.return_value =3D True expected_topology =3D {'sockets': 3, 'cores': 2, 'threads': 8} =20 - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) self.assertEqual(expected_topology, inst.vm_get_vm_cpu_topology(FakeDom())) =20 @@ -1518,12 +1508,12 @@ class ModelTests(unittest.TestCase): mock_has_topology.return_value =3D False expected_topology =3D {} =20 - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) self.assertEqual(expected_topology, inst.vm_get_vm_cpu_topology(FakeDom())) =20 def test_vm_cpu_hotplug_invalidparam_fail(self): - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) =20 with self.assertRaisesRegexp(InvalidParameter, 'KCHCPUHOTP0001E'): params =3D {"cpu_info": {"vcpus": 1, 'maxvcpus': 4}} @@ -1541,7 +1531,7 @@ class ModelTests(unittest.TestCase): return 'fakedom' =20 mock_has_topology.return_value =3D False - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) =20 with self.assertRaisesRegexp(InvalidParameter, 'KCHCPUINF0001E'): params =3D {"cpu_info": {"vcpus": 16}} @@ -1563,7 +1553,7 @@ class ModelTests(unittest.TestCase): mock_has_topology.return_value =3D True mock_topology.return_value =3D {'sockets': 3, 'cores': 2, 'threads= ': 8} =20 - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) =20 with self.assertRaisesRegexp(InvalidParameter, 'KCHCPUINF0005E'): params =3D {"cpu_info": {"vcpus": 10}} @@ -1574,13 +1564,12 @@ class ModelTests(unittest.TestCase): def setVcpusFlags(self, vcpu, flags): raise libvirt.libvirtError('') =20 - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) with self.assertRaisesRegexp(OperationFailed, 'KCHCPUHOTP0002E'): inst.vm_update_cpu_live(FakeDom(), '') =20 def test_get_interfaces(self): - inst =3D model.Model('test:///default', - objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) expected_ifaces =3D netinfo.all_favored_interfaces() ifaces =3D inst.interfaces_get_list() self.assertEquals(len(expected_ifaces), len(ifaces)) @@ -1616,8 +1605,7 @@ class ModelTests(unittest.TestCase): time.sleep(2) cb("step 3 OK", params.get('result', True)) =20 - inst =3D model.Model('test:///default', - objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) taskid =3D AsyncTask('', quick_op, 'Hello').id inst.task_wait(taskid) self.assertEquals('finished', inst.task_lookup(taskid)['status']) @@ -1742,21 +1730,17 @@ class ModelTests(unittest.TestCase): self.assertEquals(original_vm, clone_vm) =20 def test_use_test_host(self): - inst =3D model.Model('test:///default', - objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) =20 with RollbackContext() as rollback: params =3D { 'name': 'test', 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}, - 'domain': 'test', + 'domain': 'kvm', 'arch': 'i686', 'disks': [] } =20 - _setDiskPoolDefaultTest() - rollback.prependDefer(_setDiskPoolDefault) - inst.templates_create(params) rollback.prependDefer(inst.template_delete, 'test') =20 @@ -1771,8 +1755,7 @@ class ModelTests(unittest.TestCase): self.assertTrue('kimchi-vm' in vms) =20 def test_get_distros(self): - inst =3D model.Model('test:///default', - objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) distros =3D inst.distros_get_list() for d in distros: distro =3D inst.distro_lookup(d) @@ -1814,7 +1797,7 @@ class ModelTests(unittest.TestCase): @unittest.skipUnless(_host_is_power(), 'Only required for Power hosts') def test_pci_hotplug_requires_usb_controller(self): config.set("authentication", "method", "pam") - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) tpl_params =3D {'name': 'test', 'memory': 1024, 'cdrom': UBUNTU_IS= O} inst.templates_create(tpl_params) =20 @@ -1913,7 +1896,7 @@ multifunction=3D'on'/> """ =20 def test_vmhostdev_is_hostdev_multifunction(self): - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) =20 hostdev_multi_elem =3D objectify.fromstring( self.get_hostdev_multifunction_xml() @@ -1930,7 +1913,7 @@ multifunction=3D'on'/> ) =20 def test_vmhostdev_get_devices_same_addr(self): - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) =20 root =3D objectify.fromstring(self.get_hostdevs_xml()) hostdevs =3D root.devices.hostdev @@ -1971,7 +1954,7 @@ multifunction=3D'on'/> =20 mock_conf_flag.return_value =3D '' =20 - inst =3D model.Model(None, objstore_loc=3Dself.tmp_store) + inst =3D model.Model("qemu:///session", objstore_loc=3Dself.tmp_st= ore) =20 root =3D objectify.fromstring(self.get_hostdevs_xml()) hostdevs =3D root.devices.hostdev --=20 2.7.4 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel