[Kimchi-devel] [PATCH] test_model: using default pool in test_vm_disk
Aline Manera
alinefm at linux.vnet.ibm.com
Thu Jan 22 16:47:10 UTC 2015
On 22/01/2015 14:43, Daniel Henrique Barboza wrote:
>
> On 01/22/2015 02:33 PM, Aline Manera wrote:
>>
>> On 21/01/2015 13:00, Daniel Henrique Barboza wrote:
>>> In certain conditions and/or libvirt versions, the hot plug of
>>> disks won't work unless the disk belongs to the default pool.
>>
>> Does that mean I am not able to do disk hot plug if the disk does not
>> belongs to default pool on Fedora 20?
>
> I haven't found any working example in Suse or Red Hat docs in which
> the hot plug works without putting the image in
> /var/lib/libvirt/images dir. Besides, isn't that exactly what Kimchi
> does? Or does Kimchi allows hot plug a disk from any pool in any dir?
Kimchi allows hot plug in any pool in any dir.
>>
>> It does not make sense for me.
>> I should be able to hot plug any disk in any pool unless we have a
>> libvirt/qemu issue there.
>>
>>> This patch fixes github bug #507:
>>>
>>> https://github.com/kimchi-project/kimchi/issues/507
>>>
>>> Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at 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)
>>>
>>
>
More information about the Kimchi-devel
mailing list