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
This commit is contained in:
Emilien Macchi 2018-09-28 09:28:46 -04:00
parent 71f51369a0
commit 383d5f90e6
3 changed files with 14 additions and 9 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
Switch the Heat Launcher to use Podman instead of Docker when
heat_native is disabled.

View File

@ -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)

View File

@ -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)