Merge "Removed shared instances for live-migration"
This commit is contained in:
commit
87903a2f3d
@ -14,8 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
import testtools
|
||||
|
||||
from tempest.api.compute import base
|
||||
@ -26,9 +24,6 @@ from tempest import test
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
CreatedServer = namedtuple('CreatedServer', 'server_id, volume_backed')
|
||||
|
||||
|
||||
class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
||||
_host_key = 'OS-EXT-SRV-ATTR:host'
|
||||
|
||||
@ -43,10 +38,6 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def resource_setup(cls):
|
||||
super(LiveBlockMigrationTestJSON, cls).resource_setup()
|
||||
|
||||
# list of CreatedServer namedtuples
|
||||
# TODO(mriedem): Remove the instance variable and shared server re-use
|
||||
cls.created_servers = []
|
||||
|
||||
def _get_compute_hostnames(self):
|
||||
body = self.admin_hosts_client.list_hosts()['hosts']
|
||||
return [
|
||||
@ -62,18 +53,12 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def _get_host_for_server(self, server_id):
|
||||
return self._get_server_details(server_id)[self._host_key]
|
||||
|
||||
def _migrate_server_to(self, server_id, dest_host):
|
||||
# volume backed instances shouldn't be block migrated
|
||||
for id, volume_backed in self.created_servers:
|
||||
if server_id == id:
|
||||
use_block_migration = not volume_backed
|
||||
break
|
||||
else:
|
||||
raise ValueError('Server with id %s not found.' % server_id)
|
||||
bmflm = (CONF.compute_feature_enabled.
|
||||
block_migration_for_live_migration and use_block_migration)
|
||||
def _migrate_server_to(self, server_id, dest_host, volume_backed):
|
||||
block_migration = (CONF.compute_feature_enabled.
|
||||
block_migration_for_live_migration and
|
||||
not volume_backed)
|
||||
body = self.admin_servers_client.live_migrate_server(
|
||||
server_id, host=dest_host, block_migration=bmflm,
|
||||
server_id, host=dest_host, block_migration=block_migration,
|
||||
disk_over_commit=False)
|
||||
return body
|
||||
|
||||
@ -85,19 +70,10 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
||||
def _get_server_status(self, server_id):
|
||||
return self._get_server_details(server_id)['status']
|
||||
|
||||
def _get_an_active_server(self, volume_backed=False):
|
||||
for server_id, vol_backed in self.created_servers:
|
||||
if ('ACTIVE' == self._get_server_status(server_id) and
|
||||
volume_backed == vol_backed):
|
||||
return server_id
|
||||
else:
|
||||
def _create_server(self, volume_backed=False):
|
||||
server = self.create_test_server(wait_until="ACTIVE",
|
||||
volume_backed=volume_backed)
|
||||
server_id = server['id']
|
||||
new_server = CreatedServer(server_id=server_id,
|
||||
volume_backed=volume_backed)
|
||||
self.created_servers.append(new_server)
|
||||
return server_id
|
||||
return server['id']
|
||||
|
||||
def _volume_clean_up(self, server_id, volume_id):
|
||||
body = self.volumes_client.show_volume(volume_id)['volume']
|
||||
@ -117,11 +93,11 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
||||
:param volume_backed: If the instance is volume backed or not. If
|
||||
volume_backed, *block* migration is not used.
|
||||
"""
|
||||
# Live block 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._get_an_active_server(volume_backed=volume_backed)
|
||||
server_id = self._create_server(volume_backed=volume_backed)
|
||||
actual_host = self._get_host_for_server(server_id)
|
||||
target_host = self._get_host_other_than(actual_host)
|
||||
|
||||
@ -130,7 +106,7 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
||||
waiters.wait_for_server_status(self.admin_servers_client,
|
||||
server_id, state)
|
||||
|
||||
self._migrate_server_to(server_id, target_host)
|
||||
self._migrate_server_to(server_id, target_host, volume_backed)
|
||||
waiters.wait_for_server_status(self.servers_client, server_id, state)
|
||||
migration_list = (self.admin_migration_client.list_migrations()
|
||||
['migrations'])
|
||||
@ -178,11 +154,10 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
||||
block_migrate_cinder_iscsi,
|
||||
'Block Live migration not configured for iSCSI')
|
||||
def test_iscsi_volume(self):
|
||||
# Live block 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._get_an_active_server()
|
||||
server_id = self._create_server()
|
||||
actual_host = self._get_host_for_server(server_id)
|
||||
target_host = self._get_host_other_than(actual_host)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user