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 <trozet@redhat.com>
This commit is contained in:
Tim Rozet 2018-03-14 17:16:22 -04:00
parent 347ec1cab9
commit 97173caf8f
2 changed files with 24 additions and 6 deletions

View File

@ -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: |
<config xmlns="urn:opendaylight:params:xml:ns:yang:mdsalutil">
<upgradeInProgress>true</upgradeInProgress>
</config>
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: |
<config xmlns="urn:opendaylight:params:xml:ns:yang:mdsalutil">
<upgradeInProgress>false</upgradeInProgress>
</config>
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
when: odl_update_level == 2

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes OpenDaylight container service not starting due to missing config
files in /opt/opendaylight/etc directory.