Merge "Wait for guest OS ready after starting a VM"

This commit is contained in:
Zuul 2023-09-16 10:24:36 +00:00 committed by Gerrit Code Review
commit 54c29d5bfa
2 changed files with 11 additions and 3 deletions

View File

@ -288,6 +288,10 @@ class ServerStackFixture(heat.HeatStackFixture, abc.ABC):
if hypervisor in hypervisors: if hypervisor in hypervisors:
self.migrate_server(live=True, wait_for_guest_os=True) self.migrate_server(live=True, wait_for_guest_os=True)
def wait_for_guest_os_ready(self, timeout=None):
nova.wait_for_guest_os_ready(server_id=self.server_id,
timeout=timeout)
def migrate_server(self, def migrate_server(self,
live=False, live=False,
host: str = None, host: str = None,
@ -296,7 +300,7 @@ class ServerStackFixture(heat.HeatStackFixture, abc.ABC):
-> nova.NovaServer: -> nova.NovaServer:
server = nova.activate_server(server=self.server_id) server = nova.activate_server(server=self.server_id)
if wait_for_guest_os: if wait_for_guest_os:
nova.wait_for_guest_os_ready(server) self.wait_for_guest_os_ready()
if live: if live:
nova.live_migrate_server(server, nova.live_migrate_server(server,
host=host, host=host,
@ -434,12 +438,15 @@ class CloudInitServerStackFixture(ServerStackFixture, ABC):
external=True, lock_path=tobiko.LOCK_DIR) external=True, lock_path=tobiko.LOCK_DIR)
def setup_fixture(self): def setup_fixture(self):
super(CloudInitServerStackFixture, self).setup_fixture() super(CloudInitServerStackFixture, self).setup_fixture()
nova.wait_for_guest_os_ready(server_id=self.server_id, self.wait_for_guest_os_ready()
timeout=900.)
if self.has_floating_ip: if self.has_floating_ip:
self.assert_is_reachable() self.assert_is_reachable()
self.wait_for_cloud_init_done() self.wait_for_cloud_init_done()
def wait_for_guest_os_ready(self, timeout=900.):
super(CloudInitServerStackFixture, self).wait_for_guest_os_ready(
timeout=timeout)
@property @property
def is_reachable_timeout(self) -> tobiko.Seconds: def is_reachable_timeout(self) -> tobiko.Seconds:
# I expect cloud-init based servers to be slow to boot # I expect cloud-init based servers to be slow to boot

View File

@ -58,6 +58,7 @@ class BaseServerTest(testtools.TestCase):
self.assert_is_unreachable() self.assert_is_unreachable()
self.ensure_server(status='ACTIVE') self.ensure_server(status='ACTIVE')
self.stack.wait_for_guest_os_ready()
self.assert_is_reachable() self.assert_is_reachable()
@pytest.mark.server_migrate @pytest.mark.server_migrate