def live_migrate_vm(self, vm_id, destination_host):
     migration_type = self.config.migrate.incloud_live_migration
     if migration_type == 'cold':
         cold_evacuate.cold_evacuate(self.config, self.nova_client, vm_id,
                                     destination_host)
     else:
         # VM source host is taken from VM properties
         instances.incloud_live_migrate(self.nova_client, self.config,
                                        vm_id, destination_host)
 def live_migrate_vm(self, vm_id, destination_host):
     migration_type = self.config.migrate.incloud_live_migration
     if migration_type == 'cold':
         cold_evacuate.cold_evacuate(self.config, self.nova_client, vm_id,
                                     destination_host)
     else:
         # VM source host is taken from VM properties
         instances.incloud_live_migrate(self.nova_client, self.config,
                                        vm_id, destination_host)
Exemple #3
0
    def test_cold_evacuate(self):
        cold_evacuate.cold_evacuate(self.config, self.compute_api, self.server,
                                    'fake-host-5')

        # Check that services are restored after migration
        self.assertEqual(self._services['nova-compute', 'fake-host-1'].status,
                         'enabled')
        self.assertEqual(self._services['nova-compute', 'fake-host-2'].status,
                         'enabled')
        self.assertEqual(self._services['nova-compute', 'fake-host-3'].status,
                         'disabled')
        self.assertEqual(self._services['nova-compute', 'fake-host-4'].status,
                         'disabled')
        self.assertEqual(self._services['nova-compute', 'fake-host-5'].status,
                         'enabled')

        # Check that server migrated to right host
        self.assertEqual(
            getattr(self.server, cold_evacuate.INSTANCE_HOST_ATTRIBUTE),
            'fake-host-5')
    def test_cold_evacuate(self):
        cold_evacuate.cold_evacuate(self.config, self.compute_api, self.server,
                                    'fake-host-5')

        # Check that services are restored after migration
        self.assertEqual(self._services['nova-compute', 'fake-host-1'].status,
                         'enabled')
        self.assertEqual(self._services['nova-compute', 'fake-host-2'].status,
                         'enabled')
        self.assertEqual(self._services['nova-compute', 'fake-host-3'].status,
                         'disabled')
        self.assertEqual(self._services['nova-compute', 'fake-host-4'].status,
                         'disabled')
        self.assertEqual(self._services['nova-compute', 'fake-host-5'].status,
                         'enabled')

        # Check that server migrated to right host
        self.assertEqual(
            getattr(self.server, cold_evacuate.INSTANCE_HOST_ATTRIBUTE),
            'fake-host-5')