diff --git a/ansible/roles/cinder/tasks/bootstrap_service.yml b/ansible/roles/cinder/tasks/bootstrap_service.yml index fa58ccfd9b..fc97f91cfc 100644 --- a/ansible/roles/cinder/tasks/bootstrap_service.yml +++ b/ansible/roles/cinder/tasks/bootstrap_service.yml @@ -12,6 +12,8 @@ BOOTSTRAP: name: "bootstrap_cinder" restart_policy: "never" - volumes: "{{ node_config_directory }}/cinder-api/:{{ container_config_directory }}/:ro" + volumes: + - "{{ node_config_directory }}/cinder-api/:{{ container_config_directory }}/:ro" + - "kolla_logs:/var/log/kolla/" run_once: True delegate_to: "{{ groups['cinder-api'][0] }}" diff --git a/ansible/roles/cinder/tasks/start.yml b/ansible/roles/cinder/tasks/start.yml index edd08a19b1..715695e9cb 100644 --- a/ansible/roles/cinder/tasks/start.yml +++ b/ansible/roles/cinder/tasks/start.yml @@ -7,7 +7,7 @@ image: "{{ cinder_api_image_full }}" volumes: - "{{ node_config_directory }}/cinder-api/:{{ container_config_directory }}/:ro" - - "rsyslog_socket:/var/lib/kolla/rsyslog/" + - "kolla_logs:/var/log/kolla/" when: inventory_hostname in groups['cinder-api'] - name: Starting cinder-scheduler container @@ -18,7 +18,7 @@ image: "{{ cinder_scheduler_image_full }}" volumes: - "{{ node_config_directory }}/cinder-scheduler/:{{ container_config_directory }}/:ro" - - "rsyslog_socket:/var/lib/kolla/rsyslog/" + - "kolla_logs:/var/log/kolla/" when: inventory_hostname in groups['cinder-scheduler'] - name: Starting cinder-volume container @@ -32,7 +32,7 @@ - "{{ node_config_directory }}/cinder-volume/:{{ container_config_directory }}/:ro" - "/dev/:/dev/" - "/run/:/run/" - - "rsyslog_socket:/var/lib/kolla/rsyslog/" + - "kolla_logs:/var/log/kolla/" when: inventory_hostname in groups['cinder-volume'] - name: Starting cinder-backup container @@ -44,6 +44,6 @@ privileged: True volumes: - "{{ node_config_directory }}/cinder-backup/:{{ container_config_directory }}/:ro" - - "/run/kolla/log:/dev/log" - "/dev/mapper/:/dev/mapper/" + - "kolla_logs:/var/log/kolla/" when: inventory_hostname in groups['cinder-backup'] diff --git a/ansible/roles/cinder/templates/cinder.conf.j2 b/ansible/roles/cinder/templates/cinder.conf.j2 index f7d4463c7b..91c9b6a308 100644 --- a/ansible/roles/cinder/templates/cinder.conf.j2 +++ b/ansible/roles/cinder/templates/cinder.conf.j2 @@ -1,8 +1,11 @@ [DEFAULT] debug = {{ cinder_logging_debug }} -use_syslog = True -syslog_log_facility = LOG_LOCAL0 +log_dir = /var/log/kolla/cinder + +# Set use_stderr to False or the logs will also be sent to stderr +# and collected by Docker +use_stderr = False enable_v1_api=false volume_name_template = %s diff --git a/ansible/roles/common/templates/heka-openstack.toml.j2 b/ansible/roles/common/templates/heka-openstack.toml.j2 index db642dd156..306904f796 100644 --- a/ansible/roles/common/templates/heka-openstack.toml.j2 +++ b/ansible/roles/common/templates/heka-openstack.toml.j2 @@ -6,5 +6,5 @@ filename = "lua_decoders/os_openstack_log.lua" type = "LogstreamerInput" decoder = "openstack_log_decoder" log_directory = "/var/log/kolla" -file_match = '(?Pnova|glance|keystone|neutron)/(?P.*)\.log' +file_match = '(?Pnova|glance|keystone|neutron|cinder)/(?P.*)\.log' differentiator = ["Service", "_", "Program"] diff --git a/ansible/roles/common/templates/rsyslog.conf.j2 b/ansible/roles/common/templates/rsyslog.conf.j2 index 349861be47..7c76600246 100644 --- a/ansible/roles/common/templates/rsyslog.conf.j2 +++ b/ansible/roles/common/templates/rsyslog.conf.j2 @@ -16,18 +16,6 @@ $template HeatAPICfnFile,"/var/log/heat/heat-api-cfn.log" $template HeatEngineFile,"/var/log/heat/heat-engine.log" :syslogtag,contains,"heat-engine" ?HeatEngineFile -$template CinderApiFile,"/var/log/cinder/cinder-api.log" -:syslogtag,contains,"cinder-api" ?CinderApiFile - -$template CinderBackupFile,"/var/log/cinder/cinder-backup.log" -:syslogtag,contains,"cinder-backup" ?CinderBackupFile - -$template CinderSchedulerFile,"/var/log/cinder/cinder-scheduler.log" -:syslogtag,contains,"cinder-scheduler" ?CinderSchedulerFile - -$template CinderVolumeFile,"/var/log/cinder/cinder-volume.log" -:syslogtag,contains,"cinder-volume" ?CinderVolumeFile - $template MuranoEngineFile,"/var/log/murano/murano-engine.log" :syslogtag,contains,"murano-engine" ?MuranoEngineFile diff --git a/docker/cinder/cinder-api/extend_start.sh b/docker/cinder/cinder-api/extend_start.sh index 176515189d..f6e2ddb205 100644 --- a/docker/cinder/cinder-api/extend_start.sh +++ b/docker/cinder/cinder-api/extend_start.sh @@ -1,6 +1,13 @@ #!/bin/bash set -o errexit +if [[ ! -d "/var/log/kolla/cinder" ]]; then + mkdir -p /var/log/kolla/cinder +fi +if [[ $(stat -c %a /var/log/kolla/cinder) != "755" ]]; then + chmod 755 /var/log/kolla/cinder +fi + # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then diff --git a/docker/cinder/cinder-base/Dockerfile.j2 b/docker/cinder/cinder-base/Dockerfile.j2 index 41b33922db..46e87198a7 100644 --- a/docker/cinder/cinder-base/Dockerfile.j2 +++ b/docker/cinder/cinder-base/Dockerfile.j2 @@ -45,15 +45,17 @@ ADD cinder-base-archive /cinder-base-source RUN ln -s cinder-base-source/* cinder \ && useradd --user-group cinder \ && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /cinder \ - && mkdir -p /etc/cinder /var/log/cinder /var/lib/cinder /home/cinder \ + && mkdir -p /etc/cinder /var/lib/cinder /home/cinder \ && cp -r /cinder/etc/cinder/* /etc/cinder/ \ - && chown -R cinder: /etc/cinder /var/log/cinder /var/lib/cinder /home/cinder \ + && chown -R cinder: /etc/cinder /var/lib/cinder /home/cinder \ && sed -i 's|^exec_dirs.*|exec_dirs=/var/lib/kolla/venv/bin,/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin|g' /etc/cinder/rootwrap.conf -COPY cinder_sudoers /etc/sudoers.d/cinder_sudoers -RUN chmod 750 /etc/sudoers.d \ - && chmod 440 /etc/sudoers.d/cinder_sudoers - {% endif %} -RUN usermod -a -G kolla cinder +COPY cinder_sudoers /etc/sudoers.d/cinder_sudoers +COPY extend_start.sh /usr/local/bin/kolla_extend_start + +RUN usermod -a -G kolla cinder \ + && chmod 750 /etc/sudoers.d \ + && chmod 440 /etc/sudoers.d/cinder_sudoers \ + && chmod 755 /usr/local/bin/kolla_extend_start diff --git a/docker/cinder/cinder-base/extend_start.sh b/docker/cinder/cinder-base/extend_start.sh new file mode 100644 index 0000000000..2652bf2642 --- /dev/null +++ b/docker/cinder/cinder-base/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/cinder" ]]; then + mkdir -p /var/log/kolla/cinder +fi +if [[ $(stat -c %a /var/log/kolla/cinder) != "755" ]]; then + chmod 755 /var/log/kolla/cinder +fi