Fix update/upgrade or config change for ODL

OpenDaylight creates multiple files the first time it boots, which we do
not mount to the host. After the first boot, it creates a cache which we
do mount to the host. This means that on a config change or
update/upgrade of ODL the cache will not be removed, but the files will
be. This causes ODL to fail to start.

The solution is to stop the container in update/upgrade and then remove
the cache before the update happens. This will trigger the new ODL to
rebuild the cache with the new ODL version.  For config change, we also
need to remove the cache in the host_prep_tasks so that we do not end up
in a similar state.

Closes-Bug: 1775919

Change-Id: Ia457b90b765617822e9adbf07485c9ea1fe179e5
Signed-off-by: Tim Rozet <trozet@redhat.com>
This commit is contained in:
Tim Rozet 2018-06-08 10:33:17 -04:00
parent e0139adfda
commit dc9c7315ae
2 changed files with 29 additions and 1 deletions

View File

@ -145,6 +145,10 @@ outputs:
metadata_settings:
get_attr: [OpenDaylightBase, role_data, metadata_settings]
host_prep_tasks:
- name: Delete cache folder
file:
path: /var/lib/opendaylight/data/cache
state: absent
- name: create persistent directories
file:
path: "{{ item }}"
@ -181,8 +185,12 @@ outputs:
# Containerized deployment upgrade steps
- name: ODL container L2 update and upgrade tasks
block: &odl_container_upgrade_tasks
- name: remove data, journal and snapshots
- name: stop previous ODL container
docker_container:
name: opendaylight_api
state: stopped
when: step|int == 0
- name: remove data, journal and snapshots
file:
path: /var/lib/opendaylight/{{item}}
state: absent
@ -190,6 +198,7 @@ outputs:
- snapshots
- journal
- data
when: step|int == 0
- name: Set ODL upgrade flag to True
copy:
dest: /var/lib/config-data/puppet-generated/opendaylight/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-mdsalutil-config.xml
@ -231,6 +240,19 @@ outputs:
- name: store update level to update_level variable
set_fact:
odl_update_level: {get_param: ODLUpdateLevel}
- name: Stop ODL container and remove cache
block:
- name: Stop previous ODL container
docker_container:
name: opendaylight_api
state: stopped
- name: Delete cache folder
file:
path: /var/lib/opendaylight/data/cache
state: absent
when:
- step|int == 0
- odl_update_level == 1
- name: Run L2 update tasks that are similar to upgrade_tasks when update level is 2
block: *odl_container_upgrade_tasks
when: odl_update_level == 2

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes update and upgrade along with modifying configuration for
OpenDaylight deployments. See
https://bugs.launchpad.net/tripleo/+bug/1775919