Browse Source

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.

Replaces /var/log/containers/swift symlink with directories

Once we remove the symlinks in update_staks, host_prep_tasks
would create those directories.

Assuming that minor update runs before upgrades, this should
take care of upgrades too.

Conflicts:
	docker/services/swift-proxy.yaml
	docker/services/swift-storage.yaml

Change-Id: I52a74c7b5473340e2afd240d7d6af9ad5bc97544
Closes-Bug: #1833690
(cherry picked from commit d3a9614d8a
 and 90d05216b9)
changes/26/667526/1
Rabi Mishra 2 years ago
parent
commit
b1486301f2
  1. 22
      docker/services/swift-proxy.yaml
  2. 36
      docker/services/swift-storage.yaml

22
docker/services/swift-proxy.yaml

@ -220,6 +220,7 @@ outputs:
- /run:/run
- /srv/node:/srv/node
- /dev:/dev
- /var/log/containers/swift:/var/log/swift
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
- if:
@ -248,14 +249,7 @@ outputs:
with_items:
- /srv/node
- /var/log/swift
- 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
- /var/log/containers/swift
- name: Check if rsyslog exists
stat:
path: /etc/rsyslog.d
@ -265,7 +259,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
@ -274,6 +268,16 @@ outputs:
when:
- logconfig|changed
when: rsyslog_config.stat.exists
update_tasks:
- name: Check swift containers log folder/symlink exists
stat:
path: /var/log/containers/swift
register: swift_log_link
- name: Delete if symlink
file:
path: /var/log/containers/swift
state: absent
when: swift_log_link.stat.islnk is defined and swift_log_link.stat.islnk
upgrade_tasks:
- when: step|int == 0
tags: common

36
docker/services/swift-storage.yaml

@ -246,6 +246,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: &kolla_env
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
swift_account_replicator:
@ -262,6 +263,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_container_auditor:
image: &swift_container_image {get_param: DockerSwiftContainerImage}
@ -277,6 +279,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_container_replicator:
image: *swift_container_image
@ -292,6 +295,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_object_auditor:
image: &swift_object_image {get_param: DockerSwiftObjectImage}
@ -307,6 +311,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_object_replicator:
image: *swift_object_image
@ -322,6 +327,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
-
swift_account_reaper:
@ -338,6 +344,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_account_server:
image: *swift_account_image
@ -355,6 +362,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_container_updater:
image: *swift_container_image
@ -370,6 +378,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_container_server:
image: *swift_container_image
@ -387,6 +396,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_object_expirer:
image: &swift_proxy_image {get_param: DockerSwiftProxyImage}
@ -402,6 +412,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_object_updater:
image: *swift_object_image
@ -417,6 +428,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_object_server:
image: *swift_object_image
@ -434,6 +446,7 @@ outputs:
- /srv/node:/srv/node
- /dev:/dev
- /var/cache/swift:/var/cache/swift
- /var/log/containers/swift:/var/log/swift
environment: *kolla_env
swift_rsync:
image: *swift_object_image
@ -449,9 +462,9 @@ 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
# /var/cache/swift not needed in this container
environment: *kolla_env
host_prep_tasks:
- name: create persistent directories
file:
@ -461,6 +474,7 @@ outputs:
- /srv/node
- /var/log/swift
- /var/log/containers
- /var/log/containers/swift
- name: Set swift_use_local_disks fact
set_fact:
swift_use_local_disks: {get_param: SwiftUseLocalDir}
@ -469,15 +483,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 }}"
when: swift_log_stat.stat.exists
- name: swift logs readme
copy:
dest: /var/log/swift/readme.txt
@ -494,7 +499,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
@ -598,6 +603,15 @@ outputs:
file:
path: /var/run/rsyncd.pid
state: absent
- name: Check swift containers log folder/symlink exists
stat:
path: /var/log/containers/swift
register: swift_log_link
- name: Delete if symlink
file:
path: /var/log/containers/swift
state: absent
when: swift_log_link.stat.islnk is defined and swift_log_link.stat.islnk
fast_forward_upgrade_tasks:
- when:
- step|int == 0

Loading…
Cancel
Save