Merge "Switch Heat Launcher to use Podman instead of Docker when containerized"

This commit is contained in:
Zuul 2018-10-22 21:31:11 +00:00 committed by Gerrit Code Review
commit 2f662a50d6
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

@ -470,7 +470,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)