Skip Heat pod container image pull for default ephemeral heat images
In overcloud deploy, there was logic to skip the container image pull
when the default ephemeral Heat container images are being used. This is
because the images have already been prepared and tagged as coming from
the "localhost" repo.
This patch adds that same logic in heat_launcher.py directly so that it
can be used by both overcloud deploy and the launch heat command. The
unit test method for the _fetch_container_image method is updated to
test the additional logic.
Change-Id: Ibea0751de50eeba932012467a5857cc3c783b611
Signed-off-by: James Slagle <jslagle@redhat.com>
(cherry picked from commit 0b90f0dce8)
This commit is contained in:
committed by
Sandeep Yadav
parent
f507154c20
commit
8baae03287
@@ -37,6 +37,8 @@ from tenacity.wait import wait_fixed
|
||||
from tripleoclient.constants import (DEFAULT_HEAT_CONTAINER,
|
||||
DEFAULT_HEAT_API_CONTAINER,
|
||||
DEFAULT_HEAT_ENGINE_CONTAINER,
|
||||
DEFAULT_EPHEMERAL_HEAT_API_CONTAINER,
|
||||
DEFAULT_EPHEMERAL_HEAT_ENGINE_CONTAINER,
|
||||
DEFAULT_TEMPLATES_DIR,
|
||||
EPHEMERAL_HEAT_POD_NAME)
|
||||
from tripleoclient.exceptions import HeatPodMessageQueueException
|
||||
@@ -462,7 +464,18 @@ class HeatPodLauncher(HeatContainerLauncher):
|
||||
'-l', 's0', self.heat_dir])
|
||||
|
||||
def _fetch_container_image(self):
|
||||
if self.skip_heat_pull:
|
||||
# Skip trying to pull the images if they are set to the default
|
||||
# as they can't be pulled since they are tagged as localhost.
|
||||
# If the images are missing for some reason, podman will still pull
|
||||
# them by default, and error appropriately if needed.
|
||||
if (self.api_container_image ==
|
||||
DEFAULT_EPHEMERAL_HEAT_API_CONTAINER or
|
||||
self.engine_container_image ==
|
||||
DEFAULT_EPHEMERAL_HEAT_ENGINE_CONTAINER):
|
||||
skip_heat_pull = True
|
||||
else:
|
||||
skip_heat_pull = self.skip_heat_pull
|
||||
if skip_heat_pull:
|
||||
log.info("Skipping container image pull.")
|
||||
return
|
||||
# force pull of latest container image
|
||||
|
||||
@@ -20,6 +20,7 @@ import shutil
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from tripleoclient import constants
|
||||
from tripleoclient import heat_launcher
|
||||
from tripleoclient.exceptions import HeatPodMessageQueueException
|
||||
from tripleoclient.tests import base
|
||||
@@ -69,10 +70,23 @@ class TestHeatPodLauncher(base.TestCase):
|
||||
launcher._fetch_container_image()
|
||||
self.assertFalse(self.check_calls('podman pull', self.check_output))
|
||||
|
||||
# With skip_heat_pull=False, this should try and run the command to
|
||||
# pull the default images from quay.io
|
||||
launcher = self.get_launcher(skip_heat_pull=False)
|
||||
launcher._fetch_container_image()
|
||||
self.assertTrue(self.check_calls('podman pull', self.check_output))
|
||||
|
||||
# With skip_heat_pull=False, but using the default ephemeral heat
|
||||
# container images, this should still skip the command to run the pull
|
||||
launcher = self.get_launcher(skip_heat_pull=False)
|
||||
launcher.api_container_image = \
|
||||
constants.DEFAULT_EPHEMERAL_HEAT_API_CONTAINER
|
||||
launcher.engine_container_image = \
|
||||
constants.DEFAULT_EPHEMERAL_HEAT_ENGINE_CONTAINER
|
||||
self.check_output.reset_mock()
|
||||
launcher._fetch_container_image()
|
||||
self.check_output.assert_not_called()
|
||||
|
||||
@mock.patch('tripleoclient.heat_launcher.HeatPodLauncher._decode')
|
||||
def test_get_pod_state(self, mock_decode):
|
||||
launcher = self.get_launcher()
|
||||
|
||||
@@ -736,18 +736,6 @@ class DeployOvercloud(command.Command):
|
||||
|
||||
def setup_ephemeral_heat(self, parsed_args):
|
||||
self.log.info("Using ephemeral heat for stack operation")
|
||||
# Skip trying to pull the images if they are set to the default
|
||||
# as they can't be pulled since they are tagged as localhost.
|
||||
# If the images are missing for some reason, podman will still pull
|
||||
# them by default, and error appropriately if needed.
|
||||
if (parsed_args.heat_container_api_image ==
|
||||
constants.DEFAULT_EPHEMERAL_HEAT_API_CONTAINER or
|
||||
parsed_args.heat_container_engine_image ==
|
||||
constants.DEFAULT_EPHEMERAL_HEAT_ENGINE_CONTAINER):
|
||||
skip_heat_pull = True
|
||||
else:
|
||||
skip_heat_pull = parsed_args.skip_heat_pull
|
||||
|
||||
self.heat_launcher = utils.get_heat_launcher(
|
||||
parsed_args.heat_type,
|
||||
api_container_image=parsed_args.heat_container_api_image,
|
||||
@@ -756,7 +744,7 @@ class DeployOvercloud(command.Command):
|
||||
'heat-launcher'),
|
||||
use_tmp_dir=False,
|
||||
rm_heat=parsed_args.rm_heat,
|
||||
skip_heat_pull=skip_heat_pull)
|
||||
skip_heat_pull=parsed_args.skip_heat_pull)
|
||||
self.orchestration_client = utils.launch_heat(self.heat_launcher)
|
||||
self.clients.orchestration = self.orchestration_client
|
||||
|
||||
|
||||
Reference in New Issue
Block a user