From d3a9614d8a631c1d29683d6426f501b88ecc2f85 Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Fri, 21 Jun 2019 15:20:29 +0530 Subject: [PATCH] Don't create symlink for swift container logs logrotate 3.14.0 silently ignores all files when there is a broken symlink in the container. Change-Id: I52a74c7b5473340e2afd240d7d6af9ad5bc97544 Closes-Bug: #1833690 --- .../swift/swift-proxy-container-puppet.yaml | 12 +++------ .../swift/swift-storage-container-puppet.yaml | 27 ++++++++++++------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/deployment/swift/swift-proxy-container-puppet.yaml b/deployment/swift/swift-proxy-container-puppet.yaml index 0044fb5b6c..ae31d2487f 100644 --- a/deployment/swift/swift-proxy-container-puppet.yaml +++ b/deployment/swift/swift-proxy-container-puppet.yaml @@ -410,6 +410,7 @@ outputs: - /run:/run - /srv/node:/srv/node - /dev:/dev + - /var/log/containers/swift:/var/log/swift:z environment: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS - if: @@ -439,14 +440,7 @@ outputs: with_items: - { 'path': /srv/node, 'setype': svirt_sandbox_file_t } - { 'path': /var/log/swift, 'setype': svirt_sandbox_file_t } - - stat: path=/var/log/swift - register: swift_log_stat - - name: Create swift logging symlink - file: - src: /var/log/swift - dest: /var/log/containers/swift - state: link - when: swift_log_stat.stat.exists + - { 'path': /var/log/containers/swift, 'setype': svirt_sandbox_file_t } - name: Check if rsyslog exists shell: systemctl list-unit-files --type=service | grep -q rsyslog register: rsyslog_config @@ -456,7 +450,7 @@ outputs: copy: content: | # Fix for https://bugs.launchpad.net/tripleo/+bug/1776180 - local2.* /var/log/swift/swift.log + local2.* /var/log/containers/swift/swift.log & stop dest: /etc/rsyslog.d/openstack-swift.conf register: logconfig diff --git a/deployment/swift/swift-storage-container-puppet.yaml b/deployment/swift/swift-storage-container-puppet.yaml index ddde231a6b..2b91610b8c 100644 --- a/deployment/swift/swift-storage-container-puppet.yaml +++ b/deployment/swift/swift-storage-container-puppet.yaml @@ -339,6 +339,7 @@ outputs: - /srv/node:/srv/node:z - /dev:/dev - /var/cache/swift:/var/cache/swift:z + - /var/log/containers/swift:/var/log/swift:z environment: &kolla_env - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS swift_account_replicator: @@ -355,6 +356,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_container_auditor: image: &swift_container_image {get_param: ContainerSwiftContainerImage} @@ -370,6 +372,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_container_replicator: image: *swift_container_image @@ -385,6 +388,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_object_auditor: @@ -401,6 +405,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_object_replicator: image: *swift_object_image @@ -416,6 +421,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env - swift_account_reaper: @@ -432,6 +438,7 @@ outputs: - /srv/node:/srv/node:z - /dev:/dev - /var/cache/swift:/var/cache/swift:z + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_account_server: image: *swift_account_image @@ -449,6 +456,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_container_updater: image: *swift_container_image @@ -464,6 +472,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_container_server: image: *swift_container_image @@ -481,6 +490,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_object_expirer: image: &swift_proxy_image {get_param: ContainerSwiftProxyImage} @@ -496,6 +506,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_object_updater: image: *swift_object_image @@ -511,6 +522,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_object_server: image: *swift_object_image @@ -528,6 +540,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z environment: *kolla_env swift_rsync: image: *swift_object_image @@ -543,6 +556,7 @@ outputs: - /var/lib/config-data/puppet-generated/swift/:/var/lib/kolla/config_files/src:ro - /srv/node:/srv/node - /dev:/dev + - /var/log/containers/swift:/var/log/swift:z # /var/cache/swift not needed in this container environment: *kolla_env - if: @@ -562,6 +576,7 @@ outputs: - /srv/node:/srv/node - /dev:/dev - /var/cache/swift:/var/cache/swift + - /var/log/containers/swift:/var/log/swift:z - {} host_prep_tasks: @@ -573,6 +588,7 @@ outputs: with_items: - { 'path': /srv/node, 'setype': svirt_sandbox_file_t } - { 'path': /var/cache/swift, 'setype': svirt_sandbox_file_t } + - { 'path': /var/log/containers/swift, 'setype': svirt_sandbox_file_t } - { 'path': /var/log/swift, 'setype': var_log_t } - { 'path': /var/log/containers, 'setype': svirt_sandbox_file_t } - name: Set swift_use_local_disks fact @@ -583,15 +599,6 @@ outputs: path: "/srv/node/d1" state: directory when: swift_use_local_disks - - stat: path=/var/log/swift - register: swift_log_stat - - name: Create swift logging symlink - file: - src: /var/log/swift - dest: /var/log/containers/swift - state: link - ignore_errors: "{{ ansible_check_mode|bool }}" - when: swift_log_stat.stat.exists - name: swift logs readme copy: dest: /var/log/swift/readme.txt @@ -608,7 +615,7 @@ outputs: copy: content: | # Fix for https://bugs.launchpad.net/tripleo/+bug/1776180 - local2.* /var/log/swift/swift.log + local2.* /var/log/containers/swift/swift.log & stop dest: /etc/rsyslog.d/openstack-swift.conf register: logconfig