Merge "Use skip_checks for live-migration feature in test"
This commit is contained in:
@@ -27,6 +27,18 @@ CONF = config.CONF
|
|||||||
class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
||||||
_host_key = 'OS-EXT-SRV-ATTR:host'
|
_host_key = 'OS-EXT-SRV-ATTR:host'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def skip_checks(cls):
|
||||||
|
super(LiveBlockMigrationTestJSON, cls).skip_checks()
|
||||||
|
|
||||||
|
if not CONF.compute_feature_enabled.live_migration:
|
||||||
|
skip_msg = ("%s skipped as live-migration is "
|
||||||
|
"not available" % cls.__name__)
|
||||||
|
raise cls.skipException(skip_msg)
|
||||||
|
if len(cls._get_compute_hostnames()) < 2:
|
||||||
|
raise cls.skipTest(
|
||||||
|
"Less than 2 compute nodes, skipping migration test.")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(LiveBlockMigrationTestJSON, cls).setup_clients()
|
super(LiveBlockMigrationTestJSON, cls).setup_clients()
|
||||||
@@ -34,8 +46,9 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
|||||||
cls.admin_servers_client = cls.os_adm.servers_client
|
cls.admin_servers_client = cls.os_adm.servers_client
|
||||||
cls.admin_migration_client = cls.os_adm.migrations_client
|
cls.admin_migration_client = cls.os_adm.migrations_client
|
||||||
|
|
||||||
def _get_compute_hostnames(self):
|
@classmethod
|
||||||
body = self.admin_hosts_client.list_hosts()['hosts']
|
def _get_compute_hostnames(cls):
|
||||||
|
body = cls.admin_hosts_client.list_hosts()['hosts']
|
||||||
return [
|
return [
|
||||||
host_record['host_name']
|
host_record['host_name']
|
||||||
for host_record in body
|
for host_record in body
|
||||||
@@ -90,9 +103,6 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
|||||||
volume_backed, *block* migration is not used.
|
volume_backed, *block* migration is not used.
|
||||||
"""
|
"""
|
||||||
# Live migrate an instance to another host
|
# Live migrate an instance to another host
|
||||||
if len(self._get_compute_hostnames()) < 2:
|
|
||||||
raise self.skipTest(
|
|
||||||
"Less than 2 compute nodes, skipping migration test.")
|
|
||||||
server_id = self._create_server(volume_backed=volume_backed)
|
server_id = self._create_server(volume_backed=volume_backed)
|
||||||
actual_host = self._get_host_for_server(server_id)
|
actual_host = self._get_host_for_server(server_id)
|
||||||
target_host = self._get_host_other_than(actual_host)
|
target_host = self._get_host_other_than(actual_host)
|
||||||
@@ -117,14 +127,10 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
|||||||
msg)
|
msg)
|
||||||
|
|
||||||
@test.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b')
|
@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):
|
def test_live_block_migration(self):
|
||||||
self._test_live_migration()
|
self._test_live_migration()
|
||||||
|
|
||||||
@test.idempotent_id('1e107f21-61b2-4988-8f22-b196e938ab88')
|
@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,
|
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
|
||||||
'Pause is not available.')
|
'Pause is not available.')
|
||||||
@testtools.skipUnless(CONF.compute_feature_enabled
|
@testtools.skipUnless(CONF.compute_feature_enabled
|
||||||
@@ -135,24 +141,18 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
|||||||
self._test_live_migration(state='PAUSED')
|
self._test_live_migration(state='PAUSED')
|
||||||
|
|
||||||
@test.idempotent_id('5071cf17-3004-4257-ae61-73a84e28badd')
|
@test.idempotent_id('5071cf17-3004-4257-ae61-73a84e28badd')
|
||||||
@testtools.skipUnless(CONF.compute_feature_enabled.live_migration,
|
|
||||||
'Live migration not available')
|
|
||||||
@test.services('volume')
|
@test.services('volume')
|
||||||
def test_volume_backed_live_migration(self):
|
def test_volume_backed_live_migration(self):
|
||||||
self._test_live_migration(volume_backed=True)
|
self._test_live_migration(volume_backed=True)
|
||||||
|
|
||||||
@test.idempotent_id('e19c0cc6-6720-4ed8-be83-b6603ed5c812')
|
@test.idempotent_id('e19c0cc6-6720-4ed8-be83-b6603ed5c812')
|
||||||
@testtools.skipIf(not CONF.compute_feature_enabled.live_migration or not
|
@testtools.skipIf(not CONF.compute_feature_enabled.
|
||||||
CONF.compute_feature_enabled.
|
|
||||||
block_migration_for_live_migration,
|
block_migration_for_live_migration,
|
||||||
'Block Live migration not available')
|
'Block Live migration not available')
|
||||||
@testtools.skipIf(not CONF.compute_feature_enabled.
|
@testtools.skipIf(not CONF.compute_feature_enabled.
|
||||||
block_migrate_cinder_iscsi,
|
block_migrate_cinder_iscsi,
|
||||||
'Block Live migration not configured for iSCSI')
|
'Block Live migration not configured for iSCSI')
|
||||||
def test_iscsi_volume(self):
|
def test_iscsi_volume(self):
|
||||||
if len(self._get_compute_hostnames()) < 2:
|
|
||||||
raise self.skipTest(
|
|
||||||
"Less than 2 compute nodes, skipping migration test.")
|
|
||||||
server_id = self._create_server()
|
server_id = self._create_server()
|
||||||
actual_host = self._get_host_for_server(server_id)
|
actual_host = self._get_host_for_server(server_id)
|
||||||
target_host = self._get_host_other_than(actual_host)
|
target_host = self._get_host_other_than(actual_host)
|
||||||
|
|||||||
Reference in New Issue
Block a user