Add related test to Bug #1732428
Reproduce data loss when migrating unshelved qcow2 instance. Add also [compute-feature-enabled]/shelve_migrate config, to enable this test only on supported environment. Depends-On: https://review.opendev.org/#/c/696084/ Depends-On: https://review.opendev.org/#/c/752463/ Change-Id: I3044d59b4f1505accefdaafafecef685cb9a9af5 Related-Bug: #1732428
This commit is contained in:
parent
f05caef291
commit
0a9b8235b6
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add a new config option ``[compute-feature-enabled] shelve_migrate``
|
||||
which enable test for environment that support cold migration of qcow2
|
||||
unshelved instance.
|
@ -447,6 +447,10 @@ ComputeFeaturesGroup = [
|
||||
cfg.BoolOpt('shelve',
|
||||
default=True,
|
||||
help="Does the test environment support shelving/unshelving?"),
|
||||
cfg.BoolOpt('shelve_migrate',
|
||||
default=False,
|
||||
help="Does the test environment support "
|
||||
"cold migration of unshelved server?"),
|
||||
cfg.BoolOpt('suspend',
|
||||
default=True,
|
||||
help="Does the test environment support suspend/resume?"),
|
||||
|
@ -33,9 +33,18 @@ class TestShelveInstance(manager.ScenarioTest):
|
||||
* shelve the instance
|
||||
* unshelve the instance
|
||||
* check the existence of the timestamp file in the unshelved instance
|
||||
* check the existence of the timestamp file in the unshelved instance,
|
||||
after a cold migrate
|
||||
|
||||
"""
|
||||
|
||||
credentials = ['primary', 'admin']
|
||||
|
||||
@classmethod
|
||||
def setup_clients(cls):
|
||||
super(TestShelveInstance, cls).setup_clients()
|
||||
cls.admin_servers_client = cls.os_admin.servers_client
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
super(TestShelveInstance, cls).skip_checks()
|
||||
@ -50,7 +59,21 @@ class TestShelveInstance(manager.ScenarioTest):
|
||||
waiters.wait_for_server_status(self.servers_client, server['id'],
|
||||
'ACTIVE')
|
||||
|
||||
def _create_server_then_shelve_and_unshelve(self, boot_from_volume=False):
|
||||
def _cold_migrate_server(self, server):
|
||||
src_host = self.get_host_for_server(server['id'])
|
||||
|
||||
self.admin_servers_client.migrate_server(server['id'])
|
||||
waiters.wait_for_server_status(self.servers_client,
|
||||
server['id'], 'VERIFY_RESIZE')
|
||||
self.servers_client.confirm_resize_server(server['id'])
|
||||
waiters.wait_for_server_status(self.servers_client,
|
||||
server['id'], 'ACTIVE')
|
||||
|
||||
dst_host = self.get_host_for_server(server['id'])
|
||||
self.assertNotEqual(src_host, dst_host)
|
||||
|
||||
def _create_server_then_shelve_and_unshelve(self, boot_from_volume=False,
|
||||
cold_migrate=False):
|
||||
keypair = self.create_keypair()
|
||||
|
||||
security_group = self._create_security_group()
|
||||
@ -71,6 +94,10 @@ class TestShelveInstance(manager.ScenarioTest):
|
||||
# with the instance snapshot
|
||||
self._shelve_then_unshelve_server(server)
|
||||
|
||||
if cold_migrate:
|
||||
# Prevent bug #1732428 from coming back
|
||||
self._cold_migrate_server(server)
|
||||
|
||||
timestamp2 = self.get_timestamp(instance_ip,
|
||||
private_key=keypair['private_key'],
|
||||
server=server)
|
||||
@ -91,3 +118,18 @@ class TestShelveInstance(manager.ScenarioTest):
|
||||
@utils.services('compute', 'volume', 'network', 'image')
|
||||
def test_shelve_volume_backed_instance(self):
|
||||
self._create_server_then_shelve_and_unshelve(boot_from_volume=True)
|
||||
|
||||
@decorators.attr(type='slow')
|
||||
@decorators.idempotent_id('1295fd9e-193a-4cf8-b211-55358e021bae')
|
||||
@testtools.skipUnless(CONF.network.public_network_id,
|
||||
'The public_network_id option must be specified.')
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.cold_migration,
|
||||
'Cold migration not available.')
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.shelve_migrate,
|
||||
'Shelve migrate not available.')
|
||||
@testtools.skipUnless(CONF.compute.min_compute_nodes > 1,
|
||||
'Less than 2 compute nodes, skipping multinode '
|
||||
'tests.')
|
||||
@utils.services('compute', 'network', 'image')
|
||||
def test_cold_migrate_unshelved_instance(self):
|
||||
self._create_server_then_shelve_and_unshelve(cold_migrate=True)
|
||||
|
Loading…
Reference in New Issue
Block a user