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}
RoleParameters: {get_param: RoleParameters}
GlanceLogging:
type: OS::TripleO::Services::Logging::GlanceApi
outputs:
role_data:
description: Role data for the Glance API role.
@ -91,6 +94,7 @@ outputs:
config_settings:
map_merge:
- get_attr: [GlanceApiPuppetBase, role_data, config_settings]
- get_attr: [GlanceLogging, config_settings]
- glance::api::sync_db: false
logging_source: {get_attr: [GlanceApiPuppetBase, role_data, logging_source]}
logging_groups: {get_attr: [GlanceApiPuppetBase, role_data, logging_groups]}
@ -130,19 +134,11 @@ outputs:
merge: true
preserve_properties: true
docker_config:
# Kolla_bootstrap/db_sync runs before permissions set by kolla_config
step_2:
glance_init_logs:
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']
get_attr: [GlanceLogging, docker_config, step_2]
step_3:
glance_api_db_sync:
image: *glance_api_image
image: &glance_api_image {get_param: DockerGlanceApiImage}
net: host
privileged: false
detach: false
@ -150,11 +146,10 @@ outputs:
volumes: &glance_volumes
list_concat:
- {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/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
-
if:
@ -196,26 +191,21 @@ outputs:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
- {}
host_prep_tasks:
- name: Mount NFS on host
vars:
nfs_backend_enable: {get_param: GlanceNfsEnabled}
mount: name=/var/lib/glance src="{{item.NFS_SHARE}}" fstype=nfs4 opts="{{item.NFS_OPTIONS}}" state=mounted
with_items:
- NFS_SHARE: {get_param: GlanceNfsShare}
NFS_OPTIONS: {get_param: GlanceNfsOptions}
when:
- nfs_backend_enable
- name: create persistent logs directory
file:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/glance
- /var/log/containers/httpd/glance-api
- name: ensure ceph configurations exist
file:
path: /etc/ceph
state: directory
list_concat:
- {get_attr: [GlanceLogging, host_prep_tasks]}
- - name: Mount NFS on host
vars:
nfs_backend_enable: {get_param: GlanceNfsEnabled}
mount: name=/var/lib/glance src="{{item.NFS_SHARE}}" fstype=nfs4 opts="{{item.NFS_OPTIONS}}" state=mounted
with_items:
- NFS_SHARE: {get_param: GlanceNfsShare}
NFS_OPTIONS: {get_param: GlanceNfsOptions}
when:
- nfs_backend_enable
- name: ensure ceph configurations exist
file:
path: /etc/ceph
state: directory
upgrade_tasks:
- name: Stop and disable glance_api service
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:
OS::TripleO::Services::Logging::GlanceApi: ../docker/services/logging/stdout/glance-api.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
# Logging
OS::TripleO::Services::Logging::GlanceApi: docker/services/logging/files/glance-api.yaml
OS::TripleO::Services::Logging::Keystone: docker/services/logging/files/keystone.yaml
parameter_defaults: