Add option for Glance API containers to log to stdout/stderr

This adds the option to get the glance containers to log to stdout.
The option is disabled by default.

bp logging-stdout-rsyslog

Depends-On: I3fa4a38d21f0f7e447157ab7814a547c10a4b7d3
Change-Id: I81101d9ef4df2e6ece7c17025e2265489864a6f6
This commit is contained in:
Juan Antonio Osorio Robles 2017-10-09 05:58:19 +00:00
parent e5f0113f6f
commit f037da0f36
5 changed files with 87 additions and 32 deletions

View File

@ -83,6 +83,9 @@ resources:
RoleName: {get_param: RoleName} RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters} RoleParameters: {get_param: RoleParameters}
GlanceLogging:
type: OS::TripleO::Services::Logging::GlanceApi
outputs: outputs:
role_data: role_data:
description: Role data for the Glance API role. description: Role data for the Glance API role.
@ -91,6 +94,7 @@ outputs:
config_settings: config_settings:
map_merge: map_merge:
- get_attr: [GlanceApiPuppetBase, role_data, config_settings] - get_attr: [GlanceApiPuppetBase, role_data, config_settings]
- get_attr: [GlanceLogging, config_settings]
- glance::api::sync_db: false - glance::api::sync_db: false
logging_source: {get_attr: [GlanceApiPuppetBase, role_data, logging_source]} logging_source: {get_attr: [GlanceApiPuppetBase, role_data, logging_source]}
logging_groups: {get_attr: [GlanceApiPuppetBase, role_data, logging_groups]} logging_groups: {get_attr: [GlanceApiPuppetBase, role_data, logging_groups]}
@ -130,19 +134,11 @@ outputs:
merge: true merge: true
preserve_properties: true preserve_properties: true
docker_config: docker_config:
# Kolla_bootstrap/db_sync runs before permissions set by kolla_config
step_2: step_2:
glance_init_logs: get_attr: [GlanceLogging, docker_config, step_2]
image: &glance_api_image {get_param: DockerGlanceApiImage}
privileged: false
user: root
volumes:
- /var/log/containers/glance:/var/log/glance
- /var/log/containers/httpd/glance-api:/var/log/httpd
command: ['/bin/bash', '-c', 'chown -R glance:glance /var/log/glance']
step_3: step_3:
glance_api_db_sync: glance_api_db_sync:
image: *glance_api_image image: &glance_api_image {get_param: DockerGlanceApiImage}
net: host net: host
privileged: false privileged: false
detach: false detach: false
@ -150,11 +146,10 @@ outputs:
volumes: &glance_volumes volumes: &glance_volumes
list_concat: list_concat:
- {get_attr: [ContainersCommon, volumes]} - {get_attr: [ContainersCommon, volumes]}
- {get_attr: [GlanceLogging, volumes]}
- -
- /var/lib/kolla/config_files/glance_api.json:/var/lib/kolla/config_files/config.json - /var/lib/kolla/config_files/glance_api.json:/var/lib/kolla/config_files/config.json
- /var/lib/config-data/puppet-generated/glance_api/:/var/lib/kolla/config_files/src:ro - /var/lib/config-data/puppet-generated/glance_api/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/glance:/var/log/glance
- /var/log/containers/httpd/glance-api:/var/log/httpd
- /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro - /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
- -
if: if:
@ -196,26 +191,21 @@ outputs:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
- {} - {}
host_prep_tasks: host_prep_tasks:
- name: Mount NFS on host list_concat:
vars: - {get_attr: [GlanceLogging, host_prep_tasks]}
nfs_backend_enable: {get_param: GlanceNfsEnabled} - - name: Mount NFS on host
mount: name=/var/lib/glance src="{{item.NFS_SHARE}}" fstype=nfs4 opts="{{item.NFS_OPTIONS}}" state=mounted vars:
with_items: nfs_backend_enable: {get_param: GlanceNfsEnabled}
- NFS_SHARE: {get_param: GlanceNfsShare} mount: name=/var/lib/glance src="{{item.NFS_SHARE}}" fstype=nfs4 opts="{{item.NFS_OPTIONS}}" state=mounted
NFS_OPTIONS: {get_param: GlanceNfsOptions} with_items:
when: - NFS_SHARE: {get_param: GlanceNfsShare}
- nfs_backend_enable NFS_OPTIONS: {get_param: GlanceNfsOptions}
- name: create persistent logs directory when:
file: - nfs_backend_enable
path: "{{ item }}" - name: ensure ceph configurations exist
state: directory file:
with_items: path: /etc/ceph
- /var/log/containers/glance state: directory
- /var/log/containers/httpd/glance-api
- name: ensure ceph configurations exist
file:
path: /etc/ceph
state: directory
upgrade_tasks: upgrade_tasks:
- name: Stop and disable glance_api service - name: Stop and disable glance_api service
tags: step2 tags: step2

View File

@ -0,0 +1,42 @@
heat_template_version: pike
description: >
OpenStack containerized Glance API service
parameters:
DockerGlanceApiImage:
description: image
type: string
outputs:
config_settings:
description: The volumes needed to log to files in the host.
value: null
docker_config:
description: Extra containers needed for logging to files in the host.
value:
# Kolla_bootstrap/db_sync runs before permissions set by kolla_config
step_2:
glance_init_logs:
image: {get_param: DockerGlanceApiImage}
privileged: false
user: root
volumes:
- /var/log/containers/glance:/var/log/glance
- /var/log/containers/httpd/glance-api:/var/log/httpd
command: ['/bin/bash', '-c', 'chown -R glance:glance /var/log/glance']
volumes:
description: extra volumes
value:
- /var/log/containers/glance:/var/log/glance
- /var/log/containers/httpd/glance-api:/var/log/httpd
host_prep_tasks:
description: Extra ansible tasks needed for logging to files in the host.
value:
- name: create persistent logs directory
file:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/glance
- /var/log/containers/httpd/glance-api

View File

@ -0,0 +1,21 @@
heat_template_version: pike
description: >
OpenStack containerized Glance API service
outputs:
config_settings:
description: Extra hieradata needed to log to stdout.
value:
glance::api::logging::log_dir: ''
glance::api::logging::log_file: ''
docker_config:
description: Extra containers needed for logging to stdout or a sidecar container.
value:
step_2: {}
volumes:
description: The volumes needed to log to stdout or a sidecar container.
value: null
host_prep_tasks:
description: Extra ansible tasks needed for logging to files in the host.
value: null

View File

@ -1,3 +1,4 @@
resource_registry: resource_registry:
OS::TripleO::Services::Logging::GlanceApi: ../docker/services/logging/stdout/glance-api.yaml
OS::TripleO::Services::Logging::Keystone: ../docker/services/logging/stdout/keystone.yaml OS::TripleO::Services::Logging::Keystone: ../docker/services/logging/stdout/keystone.yaml

View File

@ -299,6 +299,7 @@ resource_registry:
OS::TripleO::Services::SkydiveAnalyzer: OS::Heat::None OS::TripleO::Services::SkydiveAnalyzer: OS::Heat::None
# Logging # Logging
OS::TripleO::Services::Logging::GlanceApi: docker/services/logging/files/glance-api.yaml
OS::TripleO::Services::Logging::Keystone: docker/services/logging/files/keystone.yaml OS::TripleO::Services::Logging::Keystone: docker/services/logging/files/keystone.yaml
parameter_defaults: parameter_defaults: