Merge "Wait for guest after resize"

This commit is contained in:
Zuul 2022-05-29 20:10:03 +00:00 committed by Gerrit Code Review
commit 3f1b21b923
2 changed files with 31 additions and 3 deletions

View File

@ -456,15 +456,31 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
except Exception:
LOG.exception('Failed to delete server %s', server_id)
def resize_server(self, server_id, new_flavor_id, **kwargs):
def resize_server(
self, server_id, new_flavor_id, wait_until='ACTIVE', **kwargs
):
"""resize and confirm_resize an server, waits for it to be ACTIVE."""
self.servers_client.resize_server(server_id, new_flavor_id, **kwargs)
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')
server = self.servers_client.show_server(server_id)['server']
validation_resources = self.get_class_validation_resources(
self.os_primary)
if (
validation_resources and
wait_until in ("SSHABLE", "PINGABLE") and
CONF.validation.run_validation
):
tenant_network = self.get_tenant_network()
compute.wait_for_ssh_or_ping(
server, self.os_primary, tenant_network,
True, validation_resources, wait_until, True)
self.assert_flavor_equal(new_flavor_id, server['flavor'])
def reboot_server(self, server_id, type):

View File

@ -378,10 +378,19 @@ class AttachVolumeMultiAttachTest(BaseAttachVolumeTest):
the created volume, and dict of server ID to volumeAttachment
dict entries
"""
validation_resources = self.get_class_validation_resources(
self.os_primary)
servers = []
for x in range(2):
name = 'multiattach-server-%i' % x
servers.append(self.create_test_server(name=name))
servers.append(
self.create_test_server(
name=name,
validatable=True,
validation_resources=validation_resources
)
)
# Now wait for the servers to be ACTIVE.
for server in servers:
@ -492,7 +501,10 @@ class AttachVolumeMultiAttachTest(BaseAttachVolumeTest):
servers, volume, _ = self._create_and_multiattach()
for server in servers:
self.resize_server(server['id'], self.flavor_ref_alt)
# We need to wait until the guest OS fully boots up as we are going
# to detach volumes after the resize. See bug #1960346.
self.resize_server(
server['id'], self.flavor_ref_alt, wait_until='SSHABLE')
for server in servers:
self._detach_multiattach_volume(volume['id'], server['id'])