[Kimchi-devel] [PATCH] [Kimchi 4/4] Live migration RDMA support: test changes

Daniel Henrique Barboza danielhb at linux.vnet.ibm.com
Tue Jan 10 12:34:05 UTC 2017



On 01/10/2017 10:17 AM, Aline Manera wrote:
>
> Hi Daniel,
>
> Is there no tests with the REST API to the migration feature? Is it 
> possible to add some ones?

Yes, there isn't. Back when I first developed this backend the libvirt 
test driver
didn't support the migrate API (and AFAIK still doesn't).

I am not sure if creating a mockmodel /migrate API that simply returns 
'200 OK'
when called is worth the trouble, but let me know if you think otherwise 
and I
can see what can be done.


Daniel

>
> On 01/05/2017 03:41 PM, dhbarboza82 at gmail.com wrote:
>> From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
>>
>> Added a new test for RDMA support in test_livemigration.py.
>>
>> Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
>> ---
>>   tests/test_livemigration.py | 53 
>> ++++++++++++++++++++++++++++++++++++++++++++-
>>   1 file changed, 52 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/test_livemigration.py b/tests/test_livemigration.py
>> index 7d7d458..7d49dc1 100644
>> --- a/tests/test_livemigration.py
>> +++ b/tests/test_livemigration.py
>> @@ -1,7 +1,7 @@
>>   #
>>   # Project Kimchi
>>   #
>> -# Copyright IBM Corp, 2015-2016
>> +# Copyright IBM Corp, 2015-2017
>>   #
>>   # This library is free software; you can redistribute it and/or
>>   # modify it under the terms of the GNU Lesser General Public
>> @@ -476,3 +476,54 @@ class LiveMigrationTests(unittest.TestCase):
>>               'test_vm_migrate_fake_user',
>>               'fake_password'
>>           )
>> +
>> +    @mock.patch('wok.plugins.kimchi.model.vms.VMModel.'
>> +                'migration_pre_check')
>> +    @mock.patch('wok.plugins.kimchi.model.vms.VMModel.'
>> +                '_get_remote_libvirt_conn')
>> +    @mock.patch('libvirt.virDomain.migrate')
>> +    def test_vm_livemigrate_RDMA(self, mock_migrate, mock_remote_conn,
>> +                                 mock_precheck):
>> +
>> +        mock_remote_conn.return_value = 'remote_conn'
>> +        self.create_vm_test()
>> +
>> +        try:
>> +            # removing cdrom because it is not shared storage and 
>> will make
>> +            # the migration fail
>> +            dev_list = self.inst.vmstorages_get_list('test_vm_migrate')
>> +            self.inst.vmstorage_delete('test_vm_migrate', dev_list[0])
>> +
>> +            self.inst.vm_start('test_vm_migrate')
>> +
>> +            # to make the VM transient, undefine it while it's running
>> +            vm = VMModel.get_vm(
>> +                'test_vm_migrate',
>> +                LibvirtConnection('qemu:///system')
>> +            )
>> +            vm.undefine()
>> +
>> +            self.inst.vm_migrate('test_vm_migrate',
>> +                                 KIMCHI_LIVE_MIGRATION_TEST,
>> +                                 enable_rdma=True)
>> +
>> +            flags = (libvirt.VIR_MIGRATE_PEER2PEER |
>> +                     libvirt.VIR_MIGRATE_LIVE |
>> +                     libvirt.VIR_MIGRATE_TUNNELLED)
>> +
>> +            param_uri = 'rdma://' + KIMCHI_LIVE_MIGRATION_TEST
>> +            mock_migrate.assert_called_once_with(vm, flags, param_uri)
>> +
>> +        except Exception, e:
>> +            # Clean up here instead of rollback because if the
>> +            # VM was turned transient and shut down it might
>> +            # not exist already - rollback in this case  will cause
>> +            # a QEMU error
>> +            vm = VMModel.get_vm(
>> +                'test_vm_migrate',
>> +                LibvirtConnection('qemu:///system')
>> +            )
>> +            if vm.isPersistent():
>> +                vm.undefine()
>> +            vm.shutdown()
>> +            self.fail('Migration test failed: %s' % e.message)
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>



More information about the Kimchi-devel mailing list