[Kimchi-devel] [V6 3/5] update test case to set/get user and group when VM is running

Royce Lv lvroyce at linux.vnet.ibm.com
Fri Apr 25 03:04:07 UTC 2014


Test cases fails when metadata added:
royce at royce-ThinkPad-T420:~/lvroyce/kimchi/kimchi/tests$ sudo 
./run_tests.sh test_model.ModelTests.test_use_test_host
Loading AptUpdate features.
libvirt:  error : this function is not supported by the connection 
driver: virDomainSetMetadata
libvirt:  error : this function is not supported by the connection 
driver: virDomainGetMetadata
no_domain_meta error 80
royce 3
E
======================================================================
ERROR: test_use_test_host (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 1008, in test_use_test_host
     self.assertTrue('kimchi-vm' in vms)
   File 
"/home/royce/lvroyce/kimchi/kimchi/src/kimchi/rollbackcontext.py", line 
53, in __exit__
     undo(*args, **kwargs)
   File "/home/royce/lvroyce/kimchi/kimchi/src/kimchi/model/vms.py", 
line 425, in delete
     info = self.lookup(name)
   File "/home/royce/lvroyce/kimchi/kimchi/src/kimchi/model/vms.py", 
line 382, in lookup
     access_xml = (get_vm_metadata_element(dom, "access") or
   File "/home/royce/lvroyce/kimchi/kimchi/src/kimchi/model/utils.py", 
line 104, in get_vm_metadata_element
     raise e
libvirtError: this function is not supported by the connection driver: 
virDomainGetMetadata

----------------------------------------------------------------------
Ran 1 test in 2.092s

FAILED (errors=1)

This is because test:///default does not support virDomainGetMetadata at 
my version.
We need to change this to be qemu:///system or we ignore this error when 
lookup vm information.

On 2014年04月24日 13:16, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> When vm is live, we should also get user and group correctly.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
>   tests/test_model.py | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/tests/test_model.py b/tests/test_model.py
> index b17ce00..ab22012 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -603,6 +603,19 @@ class ModelTests(unittest.TestCase):
>               self.assertRaises(InvalidParameter, inst.vm_update,
>                                 'kimchi-vm1', params)
>
> +            # change VM users and groups, when wm is running.
> +            inst.vm_update(u'kimchi-vm1',
> +                           {'users': ['root'], 'groups': ['root']})
> +            vm_info = inst.vm_lookup(u'kimchi-vm1')
> +            self.assertEquals(['root'], vm_info['users'])
> +            self.assertEquals(['root'], vm_info['groups'])
> +            # change VM users and groups by removing all elements,
> +            # when wm is running.
> +            inst.vm_update(u'kimchi-vm1', {'users': [], 'groups': []})
> +            vm_info = inst.vm_lookup(u'kimchi-vm1')
> +            self.assertEquals([], vm_info['users'])
> +            self.assertEquals([], vm_info['groups'])
> +
>               inst.vm_poweroff('kimchi-vm1')
>               self.assertRaises(OperationFailed, inst.vm_update,
>                                 'kimchi-vm1', {'name': 'kimchi-vm2'})




More information about the Kimchi-devel mailing list