In certain conditions and/or libvirt versions, the hot plug of
disks won't work unless the disk belongs to the default pool.
This patch fixes github bug #507:
https://github.com/kimchi-project/kimchi/issues/507
Signed-off-by: Daniel Henrique Barboza <dhbarboza82(a)gmail.com>
---
tests/test_model.py | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index c956007..c27e138 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -329,9 +329,6 @@ class ModelTests(unittest.TestCase):
@unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
def test_vm_disk(self):
- disk_path = '/tmp/existent2.iso'
- open(disk_path, 'w').close()
-
def _attach_disk(expect_bus='virtio'):
disk_args = {"type": "disk",
"pool": pool,
@@ -343,30 +340,13 @@ class ModelTests(unittest.TestCase):
# Check the bus type to be 'virtio'
disk_info = inst.vmstorage_lookup(vm_name, disk)
self.assertEquals(u'disk', disk_info['type'])
- self.assertEquals(vol_path, disk_info['path'])
self.assertEquals(expect_bus, disk_info['bus'])
return disk
inst = model.Model(objstore_loc=self.tmp_store)
with RollbackContext() as rollback:
- path = os.path.join(os.getcwd(), 'kimchi-images')
- pool = 'test-pool'
vol = 'test-volume.img'
- vol_path = "%s/%s" % (path, vol)
- if not os.path.exists(path):
- os.mkdir(path)
- rollback.prependDefer(shutil.rmtree, path)
-
- args = {'name': pool,
- 'path': path,
- 'type': 'dir'}
- inst.storagepools_create(args)
- rollback.prependDefer(inst.storagepool_delete, pool)
-
- # Activate the pool before adding any volume
- inst.storagepool_activate(pool)
- rollback.prependDefer(inst.storagepool_deactivate, pool)
-
+ pool = 'default'
params = {'name': vol,
'capacity': 1073741824, # 1 GiB
'allocation': 536870912, # 512 MiB
@@ -409,7 +389,7 @@ class ModelTests(unittest.TestCase):
disk_args = {"type": "disk",
"pool": pool,
"vol": vol,
- "path": disk_path}
+ "path": '/disk/path.img'}
self.assertRaises(
InvalidParameter, inst.vmstorages_create, vm_name, disk_args)
--
1.9.3