[Kimchi-devel] [PATCH] [Kimchi] Issue #924: Before deleting a storagepool, kimchi should check if any template is using that

Aline Manera alinefm at linux.vnet.ibm.com
Wed Apr 13 03:15:12 UTC 2016


Seems the problem was in my system test.
I tried again in a clean environment and everything works as expected. 
Sorry about the noise!

On 04/12/2016 08:11 PM, Jose Ricardo Ziviani wrote:
> I'm wondering why those tests didn't fail when that method was broken. :)
>
> On 12-04-2016 17:48, Aline Manera wrote:
>>
>> There are some tests failing with this patch:
>>
>> ======================================================================
>> ERROR: test_vm_cdrom (test_model.ModelTests)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>    File "test_model.py", line 571, in test_vm_cdrom
>>      vm_name, cdrom_dev, {'path': wrong_iso_path})
>>    File "/usr/lib64/python2.7/unittest/case.py", line 513, in 
>> assertRaises
>>      callableObj(*args, **kwargs)
>>    File "/home/alinefm/wok/src/wok/plugins/kimchi/model/vmstorages.py",
>> line 227, in update
>>      self.objstore, self.conn, old_disk_path)
>>    File "/home/alinefm/wok/src/wok/plugins/kimchi/model/diskutils.py",
>> line 69, in get_disk_used_by
>>      raise OperationFailed('KCHVOL0017E', {'err': e.message})
>> OperationFailed: KCHVOL0017E: KCHVOL0017E
>>
>> ======================================================================
>> ERROR: test_vm_disk (test_model.ModelTests)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>    File "test_model.py", line 484, in test_vm_disk
>>      disk = _attach_disk()
>>    File "test_model.py", line 426, in _attach_disk
>>      disk = inst.vmstorages_create(vm_name, disk_args)
>>    File "/home/alinefm/wok/src/wok/plugins/kimchi/model/vmstorages.py",
>> line 114, in create
>>      raise InvalidParameter("KCHVMSTOR0015E", {'error': e})
>> InvalidParameter: KCHVMSTOR0015E: KCHVMSTOR0015E
>>
>> ======================================================================
>> ERROR: test_vm_list_sorted (test_model.ModelTests)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>    File "test_model.py", line 1068, in test_vm_list_sorted
>>      task = inst.vms_create(params)
>>    File "/home/alinefm/wok/src/wok/plugins/kimchi/model/vms.py", line
>> 120, in create
>>      raise InvalidOperation("KCHVM0001E", {'name': name})
>> InvalidOperation: KCHVM0001E: KCHVM0001E
>>
>> ======================================================================
>> FAIL: test_image_based_template (test_model.ModelTests)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>    File "test_model.py", line 262, in test_image_based_template
>>      self.assertEquals('finished', inst.task_lookup(task_id)['status'])
>> AssertionError: 'finished' != u'failed'
>>
>> ======================================================================
>> FAIL: test_vm_lifecycle (test_model.ModelTests)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>    File "test_model.py", line 137, in test_vm_lifecycle
>>      self.assertEquals('finished', task['status'])
>> AssertionError: 'finished' != u'failed'
>>
>> ======================================================================
>> FAIL: test_get_storagevolume 
>> (test_model_storagevolume.StorageVolumeTests)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>    File "test_model_storagevolume.py", line 258, in 
>> test_get_storagevolume
>>      self.assertEquals(200, resp.status)
>> AssertionError: 200 != 500
>>
>> ======================================================================
>> FAIL: test_storagevolume_action
>> (test_model_storagevolume.StorageVolumeTests)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>    File "test_model_storagevolume.py", line 274, in
>> test_storagevolume_action
>>      _do_volume_test(self, model, host, ssl_port, 'default')
>>    File "test_model_storagevolume.py", line 73, in _do_volume_test
>>      self.assertEquals(200, resp.status)
>> AssertionError: 200 != 500
>>
>> ----------------------------------------------------------------------
>> Ran 120 tests in 846.926s
>>
>> FAILED (failures=4, errors=3, skipped=12)
>>
>>
>> On 04/07/2016 04:27 PM, Jose Ricardo Ziviani wrote:
>>> ---
>>>   model/storagepools.py | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/model/storagepools.py b/model/storagepools.py
>>> index cf3ed21..4a0d34c 100644
>>> --- a/model/storagepools.py
>>> +++ b/model/storagepools.py
>>> @@ -33,6 +33,7 @@ from wok.plugins.kimchi.model.host import DeviceModel
>>>   from wok.plugins.kimchi.model.libvirtstoragepool import 
>>> StoragePoolDef
>>>   from wok.plugins.kimchi.osinfo import defaults as tmpl_defaults
>>>   from wok.plugins.kimchi.scan import Scanner
>>> +from wok.plugins.kimchi.utils import pool_name_from_uri
>>>
>>>
>>>   ISO_POOL_NAME = u'kimchi_isos'
>>> @@ -437,7 +438,7 @@ class StoragePoolModel(object):
>>>                   t_info = session.get('template', tmpl)
>>>                   for disk in t_info['disks']:
>>>                       t_pool = disk['pool']['name']
>>> -                    if t_pool == pool_name:
>>> +                    if pool_name_from_uri(t_pool) == pool_name:
>>>                           return True
>>>               return False
>>>
>>
>




More information about the Kimchi-devel mailing list