Signed-off-by: Lucio Correia <luciojhc@linux.vnet.ibm.com>
---
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
-def _setDiskPoolDefault():
- osinfo.defaults['disks'][0]['pool'] = {
- 'name': '/plugins/kimchi/storagepools/default'}
-
-
-def _setDiskPoolDefaultTest():
- osinfo.defaults['disks'][0]['pool'] = {
- 'name': '/plugins/kimchi/storagepools/default-pool'}
-
-
class ModelTests(unittest.TestCase):
def setUp(self):
self.tmp_store = '/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'] = {}
+ LibvirtConnection._connections['qemu:///session'] = {}
if os.path.isfile(self.tmp_store):
os.unlink(self.tmp_store)
@@ -1120,7 +1110,7 @@ class ModelTests(unittest.TestCase):
def test_vm_memory_hotplug(self):
config.set("authentication", "method", "pam")
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
orig_params = {'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 = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
conn = inst.conn.get()
vm = 'non-numa-kimchi-test'
@@ -1471,21 +1461,21 @@ class ModelTests(unittest.TestCase):
xml = """<domain type='kvm'>\
<cpu><topology sockets='3' cores='2' threads='8'/></cpu>\
</domain>"""
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
self.assertEqual('2', inst.vm_get_vm_cpu_cores(xml))
def test_get_vm_cpu_sockets(self):
xml = """<domain type='kvm'>\
<cpu><topology sockets='3' cores='2' threads='8'/></cpu>\
</domain>"""
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
self.assertEqual('3', inst.vm_get_vm_cpu_sockets(xml))
def test_get_vm_cpu_threads(self):
xml = """<domain type='kvm'>\
<cpu><topology sockets='3' cores='2' threads='8'/></cpu>\
</domain>"""
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
self.assertEqual('8', inst.vm_get_vm_cpu_threads(xml))
@mock.patch('wok.plugins.kimchi.model.vms.VMModel.has_topology')
@@ -1502,7 +1492,7 @@ class ModelTests(unittest.TestCase):
mock_has_topology.return_value = True
expected_topology = {'sockets': 3, 'cores': 2, 'threads': 8}
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
self.assertEqual(expected_topology,
inst.vm_get_vm_cpu_topology(FakeDom()))
@@ -1518,12 +1508,12 @@ class ModelTests(unittest.TestCase):
mock_has_topology.return_value = False
expected_topology = {}
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
self.assertEqual(expected_topology,
inst.vm_get_vm_cpu_topology(FakeDom()))
def test_vm_cpu_hotplug_invalidparam_fail(self):
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
with self.assertRaisesRegexp(InvalidParameter, 'KCHCPUHOTP0001E'):
params = {"cpu_info": {"vcpus": 1, 'maxvcpus': 4}}
@@ -1541,7 +1531,7 @@ class ModelTests(unittest.TestCase):
return 'fakedom'
mock_has_topology.return_value = False
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
with self.assertRaisesRegexp(InvalidParameter, 'KCHCPUINF0001E'):
params = {"cpu_info": {"vcpus": 16}}
@@ -1563,7 +1553,7 @@ class ModelTests(unittest.TestCase):
mock_has_topology.return_value = True
mock_topology.return_value = {'sockets': 3, 'cores': 2, 'threads': 8}
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
with self.assertRaisesRegexp(InvalidParameter, 'KCHCPUINF0005E'):
params = {"cpu_info": {"vcpus": 10}}
@@ -1574,13 +1564,12 @@ class ModelTests(unittest.TestCase):
def setVcpusFlags(self, vcpu, flags):
raise libvirt.libvirtError('')
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
with self.assertRaisesRegexp(OperationFailed, 'KCHCPUHOTP0002E'):
inst.vm_update_cpu_live(FakeDom(), '')
def test_get_interfaces(self):
- inst = model.Model('test:///default',
- objstore_loc=self.tmp_store)
+ inst = model.Model('qemu:///session', self.tmp_store)
expected_ifaces = netinfo.all_favored_interfaces()
ifaces = 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))
- inst = model.Model('test:///default',
- objstore_loc=self.tmp_store)
+ inst = model.Model('qemu:///session', self.tmp_store)
taskid = 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)
def test_use_test_host(self):
- inst = model.Model('test:///default',
- objstore_loc=self.tmp_store)
+ inst = model.Model('qemu:///session', self.tmp_store)
with RollbackContext() as rollback:
params = {
'name': 'test',
'source_media': {'type': 'disk', 'path': UBUNTU_ISO},
- 'domain': 'test',
+ 'domain': 'kvm',
'arch': 'i686',
'disks': []
}
- _setDiskPoolDefaultTest()
- rollback.prependDefer(_setDiskPoolDefault)
-
inst.templates_create(params)
rollback.prependDefer(inst.template_delete, 'test')
@@ -1771,8 +1755,7 @@ class ModelTests(unittest.TestCase):
self.assertTrue('kimchi-vm' in vms)
def test_get_distros(self):
- inst = model.Model('test:///default',
- objstore_loc=self.tmp_store)
+ inst = model.Model('qemu:///session', self.tmp_store)
distros = inst.distros_get_list()
for d in distros:
distro = 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 = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
tpl_params = {'name': 'test', 'memory': 1024, 'cdrom': UBUNTU_ISO}
inst.templates_create(tpl_params)
@@ -1913,7 +1896,7 @@ multifunction='on'/>
"""
def test_vmhostdev_is_hostdev_multifunction(self):
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
hostdev_multi_elem = objectify.fromstring(
self.get_hostdev_multifunction_xml()
@@ -1930,7 +1913,7 @@ multifunction='on'/>
)
def test_vmhostdev_get_devices_same_addr(self):
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
root = objectify.fromstring(self.get_hostdevs_xml())
hostdevs = root.devices.hostdev
@@ -1971,7 +1954,7 @@ multifunction='on'/>
mock_conf_flag.return_value = ''
- inst = model.Model(None, objstore_loc=self.tmp_store)
+ inst = model.Model("qemu:///session", objstore_loc=self.tmp_store)
root = objectify.fromstring(self.get_hostdevs_xml())
hostdevs = root.devices.hostdev
--
2.7.4
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel
© 2016 - 2024 Red Hat, Inc.