From 383d5f90e642799bf33a316e83e7fbbb82eb2dd0 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 28 Sep 2018 09:28:46 -0400 Subject: [PATCH] Switch Heat Launcher to use Podman instead of Docker when containerized When the Heat Launcher is containerized, we don't use Docker anymore but Podman which will be the default container CLI in Stein cycle. Note: we didn't maintain Docker support for the launcher as there is no use case where we need its support for this cycle. The Heat Launcher can be non-containerized if needed. Blueprint podman-support Change-Id: I1acf0f2949390f97f3b9ea3b2a49811dcaf84d98 --- .../heat_launcher_podman-80870701fe4d99a5.yaml | 5 +++++ tripleoclient/heat_launcher.py | 16 ++++++++-------- tripleoclient/v1/tripleo_deploy.py | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 releasenotes/notes/heat_launcher_podman-80870701fe4d99a5.yaml diff --git a/releasenotes/notes/heat_launcher_podman-80870701fe4d99a5.yaml b/releasenotes/notes/heat_launcher_podman-80870701fe4d99a5.yaml new file mode 100644 index 000000000..131ffe08d --- /dev/null +++ b/releasenotes/notes/heat_launcher_podman-80870701fe4d99a5.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Switch the Heat Launcher to use Podman instead of Docker when + heat_native is disabled. diff --git a/tripleoclient/heat_launcher.py b/tripleoclient/heat_launcher.py index f71811a83..e53a4b587 100644 --- a/tripleoclient/heat_launcher.py +++ b/tripleoclient/heat_launcher.py @@ -230,15 +230,15 @@ limit_iterators=9000 temp_file.write(ks_token) -class HeatDockerLauncher(HeatBaseLauncher): +class HeatContainerLauncher(HeatBaseLauncher): def __init__(self, api_port, container_image, user='heat'): - super(HeatDockerLauncher, self).__init__(api_port, container_image, - user) + super(HeatContainerLauncher, self).__init__(api_port, container_image, + user) def launch_heat(self): cmd = [ - 'docker', 'run', + 'podman', 'run', '--name', 'heat_all', '--user', self.user, '--net', 'host', @@ -263,7 +263,7 @@ class HeatDockerLauncher(HeatBaseLauncher): def heat_db_sync(self): cmd = [ - 'docker', 'run', '--rm', + 'podman', 'run', '--rm', '--user', self.user, '--volume', '%(conf)s:/etc/heat/heat.conf:Z' % {'conf': self.config_file}, @@ -276,7 +276,7 @@ class HeatDockerLauncher(HeatBaseLauncher): def get_heat_uid(self): cmd = [ - 'docker', 'run', '--rm', + 'podman', 'run', '--rm', self.container_image, 'getent', 'passwd', self.user ] @@ -290,7 +290,7 @@ class HeatDockerLauncher(HeatBaseLauncher): def get_heat_gid(self): cmd = [ - 'docker', 'run', '--rm', + 'podman', 'run', '--rm', self.container_image, 'getent', 'group', self.user ] @@ -303,7 +303,7 @@ class HeatDockerLauncher(HeatBaseLauncher): raise Exception('Could not find heat gid') def kill_heat(self, pid): - cmd = ['docker', 'rm', '-f', 'heat_all'] + cmd = ['podman', 'rm', '-f', 'heat_all'] log.debug(' '.join(cmd)) # We don't want to hear from this command.. subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index 7ae0c36a5..da8849420 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -452,7 +452,7 @@ class Deploy(command.Command): # we do this as root to chown config files properly for docker, etc. if parsed_args.heat_native is not None and \ parsed_args.heat_native.lower() == "false": - self.heat_launch = heat_launcher.HeatDockerLauncher( + self.heat_launch = heat_launcher.HeatContainerLauncher( parsed_args.heat_api_port, parsed_args.heat_container_image, parsed_args.heat_user)