Merge "Wait for Heat message queues"

This commit is contained in:
Zuul 2021-05-14 20:11:08 +00:00 committed by Gerrit Code Review
commit bf4f51113c
4 changed files with 23 additions and 1 deletions

View File

@ -135,3 +135,7 @@ class CellExportError(Base):
class BannedParameters(Base):
"""Some of the environment parameters provided should be removed"""
class HeatPodMessageQueueException(Base):
"""Heat messaging queue not created"""

View File

@ -27,11 +27,15 @@ import tempfile
import jinja2
from oslo_utils import timeutils
from tenacity import retry, retry_if_exception_type
from tenacity.stop import stop_after_attempt, stop_after_delay
from tenacity.wait import wait_fixed
from tripleoclient.constants import (DEFAULT_HEAT_CONTAINER,
DEFAULT_HEAT_API_CONTAINER,
DEFAULT_HEAT_ENGINE_CONTAINER,
DEFAULT_TEMPLATES_DIR)
from tripleoclient.exceptions import HeatPodMessageQueueException
log = logging.getLogger(__name__)
@ -627,6 +631,19 @@ class HeatPodLauncher(HeatContainerLauncher):
def _get_num_engine_workers(self):
return int(multiprocessing.cpu_count() / 2)
@retry(retry=retry_if_exception_type(HeatPodMessageQueueException),
reraise=True,
stop=(stop_after_delay(10) | stop_after_attempt(10)),
wait=wait_fixed(0.5))
def wait_for_message_queue(self):
output = subprocess.check_output([
'sudo', 'podman', 'exec', '-it', 'rabbitmq',
'rabbitmqctl', 'list_queues'
])
if 'heat' not in str(output):
msg = "Message queue for ephemeral heat not created in time."
raise HeatPodMessageQueueException(msg)
def _write_heat_config(self):
heat_config_tmpl_path = os.path.join(DEFAULT_TEMPLATES_DIR,
"ephemeral-heat",

View File

@ -2637,6 +2637,7 @@ def launch_heat(launcher=None, restore_db=False):
# Wait for the API to be listening
heat_api_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
test_heat_api_port(heat_api_socket, launcher.host, int(launcher.api_port))
launcher.wait_for_message_queue()
_local_orchestration_client = tc_heat_utils.local_orchestration_client(
launcher.host, launcher.api_port)

View File

@ -957,7 +957,7 @@ class DeployOvercloud(command.Command):
'--heat-type',
action='store',
default='installed',
choices=['system', 'pod', 'container', 'native'],
choices=['installed', 'pod', 'container', 'native'],
help=_('The type of Heat process to use to execute '
'the deployment.\n'
'installed (Default): Use the system installed '