Move heat_launcher data to /var/log/heat-launcher

We don't want to use /var/tmp anymore because we need a place that is
persistent and consistent with other services.

Also, we need to secure the directory because it containers heat sqlite
with passwords.

Depends-On: I60d086dbbd0be409ff78c35ebce3f25b6ba5c908
Change-Id: I50d786cb19536ca6a7cea62cf57466b5302e8a42
This commit is contained in:
Emilien Macchi 2018-04-18 11:53:21 -07:00
parent 9b879e2886
commit d9b4e2ee08
1 changed files with 11 additions and 11 deletions

View File

@ -112,34 +112,34 @@ class HeatBaseLauncher(object):
# and chown them accordingly for the heat user
def __init__(self, api_port, container_image, user='heat'):
self.api_port = api_port
tmpdir = '/var/tmp/undercloud'
heatdir = '/var/log/heat-launcher'
if os.path.isdir(tmpdir):
if os.path.isdir(heatdir):
# This one may fail but it's just cleanup.
p = subprocess.Popen(['umount', tmpdir],
p = subprocess.Popen(['umount', heatdir],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
cmd_stdout, cmd_stderr = p.communicate()
retval = p.returncode
if retval != 0:
log.info('Cleanup unmount of %s failed (probably because '
'it was not mounted): %s' % (tmpdir, cmd_stderr))
'it was not mounted): %s' % (heatdir, cmd_stderr))
else:
log.info('umount of %s success' % (tmpdir))
log.info('umount of %s success' % (heatdir))
else:
# Create the directory if it doesn't exist.
try:
os.makedirs(tmpdir, mode=0o755)
os.makedirs(heatdir, mode=0o700)
except Exception as e:
log.error('Creating temp directory "%s" failed: %s' %
(tmpdir, e))
(heatdir, e))
raise Exception('Could not create temp directory %s: %s' %
(tmpdir, e))
(heatdir, e))
# As an optimization we mount the tmp directory in a tmpfs (in memory)
# filesystem. Depending on your system this can cut the heat
# deployment times by half.
p = subprocess.Popen(['mount', '-t', 'tmpfs', '-o', 'size=500M',
'tmpfs', tmpdir],
'tmpfs', heatdir],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
cmd_stdout, cmd_stderr = p.communicate()
@ -148,12 +148,12 @@ class HeatBaseLauncher(object):
# It's ok if this fails, it will still work. It just won't
# be on tmpfs.
log.warning('Unable to mount tmpfs for logs and database %s: %s' %
(tmpdir, cmd_stderr))
(heatdir, cmd_stderr))
self.policy_file = os.path.join(os.path.dirname(__file__),
'noauth_policy.json')
self.install_tmp = tempfile.mkdtemp(prefix='%s/undercloud_deploy-' %
tmpdir)
heatdir)
self.container_image = container_image
self.user = user
self.sql_db = os.path.join(self.install_tmp, 'heat.sqlite')