diff --git a/docker/services/glance-api.yaml b/docker/services/glance-api.yaml index f1cd485ef7..093018df33 100644 --- a/docker/services/glance-api.yaml +++ b/docker/services/glance-api.yaml @@ -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 diff --git a/docker/services/logging/files/glance-api.yaml b/docker/services/logging/files/glance-api.yaml new file mode 100644 index 0000000000..52c2f2a781 --- /dev/null +++ b/docker/services/logging/files/glance-api.yaml @@ -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 diff --git a/docker/services/logging/stdout/glance-api.yaml b/docker/services/logging/stdout/glance-api.yaml new file mode 100644 index 0000000000..c06a64fb3a --- /dev/null +++ b/docker/services/logging/stdout/glance-api.yaml @@ -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 diff --git a/environments/stdout-logging.yaml b/environments/stdout-logging.yaml index 4bc15afb76..0a3073e7fd 100644 --- a/environments/stdout-logging.yaml +++ b/environments/stdout-logging.yaml @@ -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 diff --git a/overcloud-resource-registry-puppet.j2.yaml b/overcloud-resource-registry-puppet.j2.yaml index 1fd8e0c153..515c2db7eb 100644 --- a/overcloud-resource-registry-puppet.j2.yaml +++ b/overcloud-resource-registry-puppet.j2.yaml @@ -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: