ensure /var/run/redis is present upon reboot

/var/run is mounted as a tmpfs, which means /var/run/redis
disappears on reboot. Since podman doesn't try to recreate a
directory if it doesn't exist, containerized redis cannot
be restarted because one of its bind mount is missing.

Force the creation of /var/run/redis after every reboot, with
default permissions. On container restart, Kolla will chown and
chmod the directory to the proper value.

Change-Id: I36c81f58c3b3e9366212a93f73b6212cca4ea569
Closes-Bug: #1826554
Depends-On: Iaa8a99eb9ced21fb6c7c87c5b56dec55383af9a9
(cherry picked from commit 75361e66b0)
This commit is contained in:
Damien Ciabrini 2019-04-26 16:41:10 +02:00 committed by Emilien Macchi
parent 3133899c11
commit 8437f6c9cd
2 changed files with 10 additions and 0 deletions

View File

@ -222,6 +222,11 @@ outputs:
- { 'path': /var/log/containers/redis, 'setype': svirt_sandbox_file_t } - { 'path': /var/log/containers/redis, 'setype': svirt_sandbox_file_t }
- { 'path': /var/run/redis, 'setype': svirt_sandbox_file_t } - { 'path': /var/run/redis, 'setype': svirt_sandbox_file_t }
- { 'path': /var/log/redis, 'setype': svirt_sandbox_file_t } - { 'path': /var/log/redis, 'setype': svirt_sandbox_file_t }
- name: ensure /var/run/redis is present upon reboot
copy:
dest: /etc/tmpfiles.d/var-run-redis.conf
content: |
d /var/run/redis 0755 root root - -
- name: redis logs readme - name: redis logs readme
copy: copy:
dest: /var/log/redis/readme.txt dest: /var/log/redis/readme.txt

View File

@ -294,6 +294,11 @@ outputs:
- { 'path': /var/log/containers/redis, 'setype': svirt_sandbox_file_t } - { 'path': /var/log/containers/redis, 'setype': svirt_sandbox_file_t }
- { 'path': /var/run/redis, 'setype': svirt_sandbox_file_t } - { 'path': /var/run/redis, 'setype': svirt_sandbox_file_t }
- { 'path': /var/log/redis, 'setype': svirt_sandbox_file_t } - { 'path': /var/log/redis, 'setype': svirt_sandbox_file_t }
- name: ensure /var/run/redis is present upon reboot
copy:
dest: /etc/tmpfiles.d/var-run-redis.conf
content: |
d /var/run/redis 0755 root root - -
- name: redis logs readme - name: redis logs readme
copy: copy:
dest: /var/log/redis/readme.txt dest: /var/log/redis/readme.txt