From 1f5929ac13a87b9efd8ee9825dc0b034ee8622b8 Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Wed, 14 Mar 2018 17:16:22 -0400 Subject: [PATCH] Fixes ODL container failing to start due to missing etc config The ODL etc directory was being overridden with an empty mount directory before kolla_start copied the puppet-generated config files. The puppet-generated config files only include modified configuration files and not all of the default config files. Therefore ODL was missing config files when it started so the container was constantly crashing. This patch removes the unwanted mount erasing the /opt/opendaylight/etc directory and moves the upgrade file to be created in puppet-generated, which will be copied at kolla start time for upgrade. The puppet-generated dir is read-only, so the REST call to disable upgrade flag in ODL will only disable it for the running instance. Therefore we have to use ansible to write the file again to disable it incase ODL is rebooted. Closes-Bug: 1755916 Change-Id: Ie380cc41ca50a294a2647d673f339d02111bf6b3 Signed-off-by: Tim Rozet (cherry picked from commit 97173caf8f68695140d207c2ab88226fd86659dc) --- docker/services/opendaylight-api.yaml | 25 ++++++++++++++----- ...l-missing-etc-config-87c33bc05f692f44.yaml | 5 ++++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/fix-odl-missing-etc-config-87c33bc05f692f44.yaml diff --git a/docker/services/opendaylight-api.yaml b/docker/services/opendaylight-api.yaml index 3cafe53d35..d053a4851f 100644 --- a/docker/services/opendaylight-api.yaml +++ b/docker/services/opendaylight-api.yaml @@ -138,7 +138,6 @@ outputs: - /var/lib/config-data/puppet-generated/opendaylight/:/var/lib/kolla/config_files/src:ro - /var/lib/opendaylight/journal:/opt/opendaylight/journal - /var/lib/opendaylight/snapshots:/opt/opendaylight/snapshots - - /var/lib/opendaylight/etc:/opt/opendaylight/etc environment: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS metadata_settings: @@ -155,7 +154,7 @@ outputs: copy: dest: /var/log/opendaylight/readme.txt content: | - Logs from opendaylight container can be found by running "docker logs opendaylight_api" + Logs from opendaylight container can be found by running "sudo docker logs opendaylight_api" ignore_errors: true upgrade_tasks: - name: Check if opendaylight is deployed @@ -174,7 +173,7 @@ outputs: - step|int == 2 - opendaylight_enabled.rc == 0 service: name=opendaylight state=stopped enabled=no - # Containarised deployment upgrade steps + # Containerized deployment upgrade steps - name: ODL container L2 update and upgrade tasks block: &odl_container_upgrade_tasks - name: remove journal and snapshots @@ -187,14 +186,17 @@ outputs: - journal - name: Set ODL upgrade flag to True copy: - dest: /var/lib/opendaylight/etc/opendaylight/datastore/initial/config/genius-mdsalutil-config.xml + dest: /var/lib/config-data/puppet-generated/opendaylight/etc/opendaylight/datastore/initial/config/genius-mdsalutil-config.xml content: | true + owner: odl + group: odl + mode: 0644 when: step|int == 1 post_upgrade_tasks: &odl_container_post_upgrade_tasks - - name: Unset upgrade flag in ODL + - name: Disable Upgrade Flag via Rest shell: str_replace: template: 'curl -k -v --silent --fail -u ODL_USERNAME:$ODL_PASSWORD -X \ @@ -206,6 +208,17 @@ outputs: $ODL_PASSWORD: {get_attr: [OpenDaylightBase, role_data, config_settings, 'opendaylight::password']} $ODL_URI: {get_param: [EndpointMap, OpenDaylightInternal, uri]} when: step|int == 0 + - name: Disable Upgrade in Config File + copy: + dest: /var/lib/config-data/puppet-generated/opendaylight/etc/opendaylight/datastore/initial/config/genius-mdsalutil-config.xml + content: | + + false + + owner: odl + group: odl + mode: 0644 + when: step|int == 0 update_tasks: - name: Get ODL update level block: &get_odl_update_level @@ -218,4 +231,4 @@ outputs: post_update_tasks: - block: *get_odl_update_level - block: *odl_container_post_upgrade_tasks - when: odl_update_level == 2 \ No newline at end of file + when: odl_update_level == 2 diff --git a/releasenotes/notes/fix-odl-missing-etc-config-87c33bc05f692f44.yaml b/releasenotes/notes/fix-odl-missing-etc-config-87c33bc05f692f44.yaml new file mode 100644 index 0000000000..0dc4ba8fd8 --- /dev/null +++ b/releasenotes/notes/fix-odl-missing-etc-config-87c33bc05f692f44.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixes OpenDaylight container service not starting due to missing config + files in /opt/opendaylight/etc directory.