Add option for Neutron containers to log to stdout/stderr

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

bp logging-stdout-rsyslog

Change-Id: I0f9d201d93da702b702e7ecf4b43a6d705389846
This commit is contained in:
Juan Antonio Osorio Robles 2017-10-09 10:01:07 +00:00
parent e463ca15fb
commit e0441af380
11 changed files with 156 additions and 65 deletions

View File

@ -0,0 +1,40 @@
heat_template_version: pike
description: >
OpenStack containerized Neutron API service
parameters:
DockerNeutronApiImage:
description: image
type: string
outputs:
config_settings:
description: Extra hieradata needed to log to files in the host.
value: null
volumes:
description: extra volumes
value: &neutron_api_volumes
- /var/log/containers/neutron:/var/log/neutron
- /var/log/containers/httpd/neutron-api:/var/log/httpd
docker_config:
description: Extra containers needed for logging to files in the host.
value:
# db sync runs before permissions set by kolla_config
step_2:
neutron_init_logs:
image: {get_param: DockerNeutronApiImage}
privileged: false
user: root
volumes: *neutron_api_volumes
command: ['/bin/bash', '-c', 'chown -R neutron:neutron /var/log/neutron']
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/neutron
- /var/log/containers/httpd/neutron-api

View File

@ -0,0 +1,26 @@
heat_template_version: pike
description: >
OpenStack containerized Neutron service
outputs:
config_settings:
description: Extra hieradata needed to log to files in the host.
value: null
docker_config:
description: Extra containers needed for logging to files in the host.
value:
step_2: {}
volumes:
description: The volumes needed to log to files in the host.
value:
- /var/log/containers/neutron:/var/log/neutron
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/neutron

View File

@ -0,0 +1,20 @@
heat_template_version: pike
description: >
OpenStack containerized Neutron API service
outputs:
config_settings:
description: Extra hieradata needed to log to stdout.
value:
neutron::logging::log_dir: ''
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

@ -66,6 +66,9 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
NeutronLogging:
type: OS::TripleO::Services::Logging::NeutronApi
outputs:
role_data:
description: Role data for the Neutron API role.
@ -76,6 +79,7 @@ outputs:
config_settings:
map_merge:
- get_attr: [NeutronBase, role_data, config_settings]
- get_attr: [NeutronLogging, config_settings]
step_config: &step_config
list_join:
- "\n"
@ -108,19 +112,11 @@ outputs:
merge: true
preserve_properties: true
docker_config:
# db sync runs before permissions set by kolla_config
step_2:
neutron_init_logs:
image: &neutron_api_image {get_param: DockerNeutronApiImage}
privileged: false
user: root
volumes:
- /var/log/containers/neutron:/var/log/neutron
- /var/log/containers/httpd/neutron-api:/var/log/httpd
command: ['/bin/bash', '-c', 'chown -R neutron:neutron /var/log/neutron']
get_attr: [NeutronLogging, docker_config, step_2]
step_3:
neutron_db_sync:
image: *neutron_api_image
image: &neutron_api_image {get_param: DockerNeutronApiImage}
net: host
privileged: false
detach: false
@ -128,12 +124,11 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [NeutronLogging, volumes]}
-
- /var/lib/config-data/neutron/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
- /var/lib/config-data/neutron/etc/neutron:/etc/neutron:ro
- /var/lib/config-data/neutron/usr/share/neutron:/usr/share/neutron:ro
- /var/log/containers/neutron:/var/log/neutron
- /var/log/containers/httpd/neutron-api:/var/log/httpd
command: ['/usr/bin/bootstrap_host_exec', 'neutron_api', 'neutron-db-manage', 'upgrade', 'heads']
# FIXME: we should make config file permissions right
# and run as neutron user
@ -148,11 +143,10 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [NeutronLogging, volumes]}
-
- /var/lib/kolla/config_files/neutron_api.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/neutron/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/neutron:/var/log/neutron
- /var/log/containers/httpd/neutron-api:/var/log/httpd
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
- if:
@ -173,14 +167,7 @@ outputs:
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
- {}
host_prep_tasks:
- name: create persistent logs directory
file:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/neutron
- /var/log/containers/httpd/neutron-api
host_prep_tasks: {get_attr: [NeutronLogging, host_prep_tasks]}
upgrade_tasks:
- name: Check if neutron_server is deployed
command: systemctl is-enabled neutron-server

View File

@ -52,6 +52,9 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
NeutronLogging:
type: OS::TripleO::Services::Logging::NeutronCommon
outputs:
role_data:
description: Role data for the Neutron DHCP role.
@ -60,6 +63,7 @@ outputs:
config_settings:
map_merge:
- get_attr: [NeutronBase, role_data, config_settings]
- get_attr: [NeutronLogging, config_settings]
logging_source: {get_attr: [NeutronBase, role_data, logging_source]}
logging_groups: {get_attr: [NeutronBase, role_data, logging_groups]}
step_config: &step_config
@ -97,24 +101,22 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [NeutronLogging, volumes]}
-
- /var/lib/kolla/config_files/neutron_dhcp.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/neutron/:/var/lib/kolla/config_files/src:ro
- /lib/modules:/lib/modules:ro
- /run/:/run
- /var/lib/neutron:/var/lib/neutron
- /var/log/containers/neutron:/var/log/neutron
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create /var/lib/neutron
file:
path: /var/lib/neutron
state: directory
- name: create persistent logs directory
file:
path: /var/log/containers/neutron
state: directory
list_concat:
- {get_attr: [NeutronLogging, host_prep_tasks]}
- - name: create /var/lib/neutron
file:
path: /var/lib/neutron
state: directory
upgrade_tasks:
- name: Check if neutron_dhcp_agent is deployed
command: systemctl is-enabled neutron-dhcp-agent

View File

@ -52,12 +52,18 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
NeutronLogging:
type: OS::TripleO::Services::Logging::NeutronCommon
outputs:
role_data:
description: Role data for Neutron L3 agent
value:
service_name: {get_attr: [NeutronL3Base, role_data, service_name]}
config_settings: {get_attr: [NeutronL3Base, role_data, config_settings]}
config_settings:
map_merge:
- get_attr: [NeutronL3Base, role_data, config_settings]
- get_attr: [NeutronLogging, config_settings]
logging_source: {get_attr: [NeutronL3Base, role_data, logging_source]}
logging_groups: {get_attr: [NeutronL3Base, role_data, logging_groups]}
step_config: &step_config
@ -93,24 +99,22 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [NeutronLogging, volumes]}
-
- /var/lib/kolla/config_files/neutron_l3_agent.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/neutron/:/var/lib/kolla/config_files/src:ro
- /lib/modules:/lib/modules:ro
- /run:/run
- /var/lib/neutron:/var/lib/neutron
- /var/log/containers/neutron:/var/log/neutron
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create /var/lib/neutron
file:
path: /var/lib/neutron
state: directory
- name: create persistent logs directory
file:
path: /var/log/containers/neutron
state: directory
list_concat:
- {get_attr: [NeutronLogging, host_prep_tasks]}
- - name: create /var/lib/neutron
file:
path: /var/lib/neutron
state: directory
upgrade_tasks:
- name: Stop and disable neutron_l3 service
tags: step2

View File

@ -52,12 +52,18 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
NeutronLogging:
type: OS::TripleO::Services::Logging::NeutronCommon
outputs:
role_data:
description: Role data for Neutron Metadata agent
value:
service_name: {get_attr: [NeutronMetadataBase, role_data, service_name]}
config_settings: {get_attr: [NeutronMetadataBase, role_data, config_settings]}
config_settings:
map_merge:
- get_attr: [NeutronMetadataBase, role_data, config_settings]
- get_attr: [NeutronLogging, config_settings]
logging_source: {get_attr: [NeutronMetadataBase, role_data, logging_source]}
logging_groups: {get_attr: [NeutronMetadataBase, role_data, logging_groups]}
step_config: &step_config
@ -93,24 +99,22 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [NeutronLogging, volumes]}
-
- /var/lib/kolla/config_files/neutron_metadata_agent.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/neutron/:/var/lib/kolla/config_files/src:ro
- /lib/modules:/lib/modules:ro
- /run:/run
- /var/lib/neutron:/var/lib/neutron
- /var/log/containers/neutron:/var/log/neutron
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create /var/lib/neutron
file:
path: /var/lib/neutron
state: directory
- name: create persistent logs directory
file:
path: /var/log/containers/neutron
state: directory
list_concat:
- {get_attr: [NeutronLogging, host_prep_tasks]}
- - name: create /var/lib/neutron
file:
path: /var/lib/neutron
state: directory
upgrade_tasks:
- name: Check if neutron_metadata_agent is deployed
command: systemctl is-enabled neutron-metadata-agent

View File

@ -56,12 +56,18 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
NeutronLogging:
type: OS::TripleO::Services::Logging::NeutronCommon
outputs:
role_data:
description: Role data for Neutron openvswitch service
value:
service_name: {get_attr: [NeutronOvsAgentBase, role_data, service_name]}
config_settings: {get_attr: [NeutronOvsAgentBase, role_data, config_settings]}
config_settings:
map_merge:
- get_attr: [NeutronOvsAgentBase, role_data, config_settings]
- get_attr: [NeutronLogging, config_settings]
logging_source: {get_attr: [NeutronOvsAgentBase, role_data, logging_source]}
logging_groups: {get_attr: [NeutronOvsAgentBase, role_data, logging_groups]}
step_config: &step_config
@ -125,19 +131,15 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [NeutronLogging, volumes]}
-
- /var/lib/kolla/config_files/neutron_ovs_agent.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/neutron/:/var/lib/kolla/config_files/src:ro
- /lib/modules:/lib/modules:ro
- /run:/run
- /var/log/containers/neutron:/var/log/neutron
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create persistent logs directory
file:
path: /var/log/containers/neutron
state: directory
host_prep_tasks: {get_attr: [NeutronLogging, host_prep_tasks]}
upgrade_tasks:
- name: Stop and disable neutron_ovs_agent service
tags: step2

View File

@ -52,12 +52,18 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
NeutronLogging:
type: OS::TripleO::Services::Logging::NeutronCommon
outputs:
role_data:
description: Role data for Neutron sriov service
value:
service_name: {get_attr: [NeutronSriovAgentBase, role_data, service_name]}
config_settings: {get_attr: [NeutronSriovAgentBase, role_data, config_settings]}
config_settings:
map_merge:
- get_attr: [NeutronSriovAgentBase, role_data, config_settings]
- get_attr: [NeutronLogging, config_settings]
step_config: &step_config
get_attr: [NeutronSriovAgentBase, role_data, step_config]
puppet_config:
@ -88,20 +94,16 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [NeutronLogging, volumes]}
-
- /var/lib/kolla/config_files/neutron_sriov_agent.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/neutron/:/var/lib/kolla/config_files/src:ro
- /lib/modules:/lib/modules:ro
- /run:/run
- /var/log/containers/neutron:/var/log/neutron
- /sys/class/net:/sys/class/net:rw
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create persistent logs directory
file:
path: /var/log/containers/neutron
state: directory
host_prep_tasks: {get_attr: [NeutronLogging, host_prep_tasks]}
upgrade_tasks:
- name: Stop and disable neutron_sriov_agent service
tags: step2

View File

@ -2,6 +2,8 @@ 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::NeutronApi: ../docker/services/logging/stdout/neutron-common.yaml
OS::TripleO::Services::Logging::NeutronCommon: ../docker/services/logging/stdout/neutron-common.yaml
OS::TripleO::Services::Logging::NovaApi: ../docker/services/logging/stdout/nova-api.yaml
OS::TripleO::Services::Logging::NovaCommon: ../docker/services/logging/stdout/nova-common.yaml
OS::TripleO::Services::Logging::NovaPlacement: ../docker/services/logging/stdout/nova-placement.yaml

View File

@ -303,6 +303,8 @@ resource_registry:
# 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::NeutronApi: docker/services/logging/files/neutron-api.yaml
OS::TripleO::Services::Logging::NeutronCommon: docker/services/logging/files/neutron-common.yaml
OS::TripleO::Services::Logging::NovaApi: docker/services/logging/files/nova-api.yaml
OS::TripleO::Services::Logging::NovaCommon: docker/services/logging/files/nova-common.yaml
OS::TripleO::Services::Logging::NovaPlacement: docker/services/logging/files/nova-placement.yaml