Merge "Store ODL logs to file"

This commit is contained in:
Zuul 2018-07-06 13:34:01 +00:00 committed by Gerrit Code Review
commit 1842528f14
6 changed files with 61 additions and 23 deletions

@ -0,0 +1,32 @@
heat_template_version: rocky
description: >
Logging configuration for containerized OpenDaylight API 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_1: {}
volumes:
description: The volumes needed to log to files in the host.
value:
- /var/log/containers/opendaylight:/opt/opendaylight/data/log
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/opendaylight
- /var/log/opendaylight
- name: opendaylight logs readme
copy:
dest: /var/log/opendaylight/readme.txt
content: |
Logs from OpenDaylight container can be found at /var/log/containers/opendaylight/karaf.log
ignore_errors: true

@ -72,6 +72,9 @@ resources:
RoleName: {get_param: RoleName} RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters} RoleParameters: {get_param: RoleParameters}
OpenDaylightApiLogging:
type: OS::TripleO::Services::Logging::OpenDaylightApi
outputs: outputs:
role_data: role_data:
description: Role data for the OpenDaylight API role. description: Role data for the OpenDaylight API role.
@ -133,38 +136,33 @@ outputs:
volumes: volumes:
list_concat: list_concat:
- {get_attr: [ContainersCommon, volumes]} - {get_attr: [ContainersCommon, volumes]}
- {get_attr: [OpenDaylightApiLogging, volumes]}
- -
- /var/lib/kolla/config_files/opendaylight_api.json:/var/lib/kolla/config_files/config.json:ro - /var/lib/kolla/config_files/opendaylight_api.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/opendaylight/:/var/lib/kolla/config_files/src:ro - /var/lib/config-data/puppet-generated/opendaylight/:/var/lib/kolla/config_files/src:ro
- /var/lib/opendaylight/journal:/opt/opendaylight/journal - /var/lib/opendaylight/journal:/opt/opendaylight/journal
- /var/lib/opendaylight/snapshots:/opt/opendaylight/snapshots - /var/lib/opendaylight/snapshots:/opt/opendaylight/snapshots
- /var/lib/opendaylight/data:/opt/opendaylight/data - /var/lib/opendaylight/data:/opt/opendaylight/data
- /var/log/containers/opendaylight:/opt/opendaylight/data/log
environment: environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
metadata_settings: metadata_settings:
get_attr: [OpenDaylightBase, role_data, metadata_settings] get_attr: [OpenDaylightBase, role_data, metadata_settings]
host_prep_tasks: host_prep_tasks:
- name: Delete cache folder list_concat:
file: - {get_attr: [OpenDaylightApiLogging, host_prep_tasks]}
path: /var/lib/opendaylight/data/cache -
state: absent - name: Delete cache folder
- name: create persistent directories file:
file: path: /var/lib/opendaylight/data/cache
path: "{{ item }}" state: absent
state: directory - name: create persistent directories
with_items: file:
- /var/lib/opendaylight/snapshots path: "{{ item }}"
- /var/lib/opendaylight/journal state: directory
- /var/lib/opendaylight/data with_items:
- /var/log/opendaylight - /var/lib/opendaylight/snapshots
- /var/log/containers/opendaylight - /var/lib/opendaylight/journal
- name: opendaylight logs readme - /var/lib/opendaylight/data
copy:
dest: /var/log/opendaylight/readme.txt
content: |
Logs from opendaylight container can be found by running "sudo docker logs opendaylight_api" and are also available in /var/log/containers/opendaylight/karaf.log
ignore_errors: true
upgrade_tasks: upgrade_tasks:
- when: step|int == 0 - when: step|int == 0
tags: common tags: common

@ -13,4 +13,3 @@ parameter_defaults:
NeutronPluginExtensions: 'port_security' NeutronPluginExtensions: 'port_security'
NeutronMechanismDrivers: 'opendaylight_v2' NeutronMechanismDrivers: 'opendaylight_v2'
NeutronServicePlugins: 'odl-router_v2,trunk' NeutronServicePlugins: 'odl-router_v2,trunk'
OpenDaylightLogMechanism: 'console'

@ -14,4 +14,3 @@ parameter_defaults:
NeutronPluginExtensions: 'port_security' NeutronPluginExtensions: 'port_security'
NeutronMechanismDrivers: 'opendaylight_v2' NeutronMechanismDrivers: 'opendaylight_v2'
NeutronServicePlugins: 'odl-router_v2,trunk' NeutronServicePlugins: 'odl-router_v2,trunk'
OpenDaylightLogMechanism: 'console'

@ -338,6 +338,7 @@ resource_registry:
OS::TripleO::Services::Logging::NovaCommon: docker/services/logging/files/nova-common.yaml OS::TripleO::Services::Logging::NovaCommon: docker/services/logging/files/nova-common.yaml
OS::TripleO::Services::Logging::NovaLibvirt: OS::Heat::None OS::TripleO::Services::Logging::NovaLibvirt: OS::Heat::None
OS::TripleO::Services::Logging::NovaPlacement: docker/services/logging/files/nova-placement.yaml OS::TripleO::Services::Logging::NovaPlacement: docker/services/logging/files/nova-placement.yaml
OS::TripleO::Services::Logging::OpenDaylightApi: docker/services/logging/files/opendaylight-api.yaml
OS::TripleO::Services::Logging::PankoApi: docker/services/logging/files/panko-api.yaml OS::TripleO::Services::Logging::PankoApi: docker/services/logging/files/panko-api.yaml
# Tempest # Tempest

@ -0,0 +1,9 @@
---
features:
- |
Configure ODL to log to file instead of console. Also ODL
log configuration has been moved out of general service
configurations to a stand-alone config file at
docker/services/logging/files/opendaylight-api.yaml. ODL
logs are now accessible at /var/log/containers/opendaylight/
karaf.log