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

Aline Manera alinefm at linux.vnet.ibm.com
Tue Jan 10 12:17:09 UTC 2017


Hi Daniel,

Is there no tests with the REST API to the migration feature? Is it 
possible to add some ones?

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)



More information about the Kimchi-devel mailing list