Test live migrate on a paused instance
Nova change Ib38eaf412cb51a9cbfc443c5ec15c5797265ddae adds support for
doing live migration of a paused instance, this adds the test to cover
that scenario.
This also depends on a series of devstack-gate changes to support
multi-host testing in the experimental queue. Specifically, this is
tested in the check-tempest-dsvm-aiopcpu-full job.
Depends-On: I89b7e390bf1cf4f2eccabca2e31a9d1b6b270677
Co-Authored By: "Matthew Gilliard <matthew.gilliard@hp.com>"
Related-Bug: #1305062
Change-Id: I5c6fd3de7ea45d1851bb40037c64ad7fb5e6dc48
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 2a72635..6be06b9 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -396,6 +396,11 @@
# https://bugs.launchpad.net/nova/+bug/1398999 (boolean value)
#block_migrate_cinder_iscsi = false
+# Does the test system allow live-migration of paused instances? Note,
+# this is more than just the ANDing of paused and live_migrate, but
+# all 3 should be set to True to run those tests (boolean value)
+#live_migrate_paused_instances = false
+
# Enable VNC console. This configuration value should be same as
# [nova.vnc]->vnc_enabled in nova.conf (boolean value)
#vnc_console = false
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 8a92326..d3b1f5e 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -84,10 +84,15 @@
self.volumes_client.wait_for_volume_status(volume_id, 'available')
self.volumes_client.delete_volume(volume_id)
- @test.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b')
- @testtools.skipIf(not CONF.compute_feature_enabled.live_migration,
- 'Live migration not available')
- def test_live_block_migration(self):
+ def _test_live_block_migration(self, state='ACTIVE'):
+ """Tests live block migration between two hosts.
+
+ Requires CONF.compute_feature_enabled.live_migration to be True.
+
+ :param state: The vm_state the migrated server should be in before and
+ after the live migration. Supported values are 'ACTIVE'
+ and 'PAUSED'.
+ """
# Live block migrate an instance to another host
if len(self._get_compute_hostnames()) < 2:
raise self.skipTest(
@@ -95,10 +100,33 @@
server_id = self._get_an_active_server()
actual_host = self._get_host_for_server(server_id)
target_host = self._get_host_other_than(actual_host)
+
+ if state == 'PAUSED':
+ self.admin_servers_client.pause_server(server_id)
+ self.admin_servers_client.wait_for_server_status(server_id, state)
+
self._migrate_server_to(server_id, target_host)
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ self.servers_client.wait_for_server_status(server_id, state)
self.assertEqual(target_host, self._get_host_for_server(server_id))
+ @test.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b')
+ @testtools.skipUnless(CONF.compute_feature_enabled.live_migration,
+ 'Live migration not available')
+ def test_live_block_migration(self):
+ self._test_live_block_migration()
+
+ @test.idempotent_id('1e107f21-61b2-4988-8f22-b196e938ab88')
+ @testtools.skipUnless(CONF.compute_feature_enabled.live_migration,
+ 'Live migration not available')
+ @testtools.skipUnless(CONF.compute_feature_enabled.pause,
+ 'Pause is not available.')
+ @testtools.skipUnless(CONF.compute_feature_enabled
+ .live_migrate_paused_instances,
+ 'Live migration of paused instances is not '
+ 'available.')
+ def test_live_block_migration_paused(self):
+ self._test_live_block_migration(state='PAUSED')
+
@test.idempotent_id('e19c0cc6-6720-4ed8-be83-b6603ed5c812')
@testtools.skipIf(not CONF.compute_feature_enabled.live_migration or not
CONF.compute_feature_enabled.
diff --git a/tempest/config.py b/tempest/config.py
index bcbe41f..a299c45 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -335,6 +335,13 @@
help="Does the test environment block migration support "
"cinder iSCSI volumes. Note, libvirt doesn't support this, "
"see https://bugs.launchpad.net/nova/+bug/1398999"),
+ # TODO(gilliard): Remove live_migrate_paused_instances at juno-eol.
+ cfg.BoolOpt('live_migrate_paused_instances',
+ default=False,
+ help="Does the test system allow live-migration of paused "
+ "instances? Note, this is more than just the ANDing of "
+ "paused and live_migrate, but all 3 should be set to True "
+ "to run those tests"),
cfg.BoolOpt('vnc_console',
default=False,
help='Enable VNC console. This configuration value should '