Upgrade ODL

Major upgrade (Q -> R) is complex in ODL. There are multiple components
involved.

This patch enables major upgrade of ODL. Steps involved are:
1. Block OVS instances to connect to ODL
2. Set ODL upgrade flag to True
3. Start ODL
4. Start Neutron re-sync and wait for it to finish
5. Delete OVS groups and ports
6. Stop OVS
7. Unblock OVS ports
8. Start OVS
9. Unset ODL upgrade flag

Change-Id: Icf98a1215900762a0677aabee1cccbf1d130e5bd
This commit is contained in:
Janki Chhatbar 2018-01-17 12:28:55 +05:30
parent 86e3cf22ef
commit 886b815509
4 changed files with 80 additions and 2 deletions

View File

@ -20,7 +20,7 @@
{% set deploy_steps_max = 6 -%}
{% set update_steps_max = 6 -%}
{% set upgrade_steps_max = 6 -%}
{% set post_upgrade_steps_max = 2 -%}
{% set post_upgrade_steps_max = 4 -%}
heat_template_version: queens

View File

@ -113,6 +113,7 @@ 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
-
if:
- internal_tls_enabled
@ -154,3 +155,33 @@ outputs:
- name: Stop and disable opendaylight_api service
when: (opendaylight_enabled.rc == 0) and (step|int == 2)
service: name=opendaylight state=stopped enabled=no
# Containarised deployment upgrade steps
- name: remove journal and snapshots
when: step|int == 0
file:
path: /var/lib/opendaylight/{{item}}
state: absent
with_items:
- snapshots
- journal
- name: Set ODL upgrade flag to True
copy:
dest: /var/lib/opendaylight/etc/opendaylight/datastore/initial/config/genius-mdsalutil-config.xml
content: |
<config xmlns="urn:opendaylight:params:xml:ns:yang:mdsalutil">
<upgradeInProgress>true</upgradeInProgress>
</config>
when: step|int == 1
post_upgrade_tasks:
- name: Unset upgrade flag in ODL
shell:
str_replace:
template: 'curl -k -v --silent --fail -u ODL_USERNAME:$ODL_PASSWORD -X \
PUT -d "{ "config": { "upgradeInProgress": false } }" \
-H "Content-Type: application/json" \
$ODL_URI/restconf/config/genius-mdsalutil:config'
params:
$ODL_USERNAME: {get_param: [OpenDaylightBase, OpenDaylightUsername]}
$ODL_PASSWORD: {get_param: [OpenDaylightBase, OpenDaylightPassword]}
$ODL_URI: {get_param: [EndpointMap, OpenDaylightInternal, uri]}
when: step|int == 0

View File

@ -215,12 +215,43 @@ outputs:
ignore_errors: True
register: openvswitch_enabled
- name: "PreUpgrade step0,validation: Check service openvswitch is running"
shell: /usr/bin/systemctl show 'openvswitch' --property ActiveState | grep '\bactive\b'
command: systemctl is-active --quiet openvswitch
when: (openvswitch_enabled.rc == 0) and (step|int == 0)
tags: validation
- name: Stop openvswitch service
when: (openvswitch_enabled.rc == 0) and (step|int == 1)
service: name=openvswitch state=stopped
# Container upgrade steps.
- name: Block connections to ODL. #This rule will be inserted at the top.
iptables: chain=OUTPUT action=insert protocol=tcp destination_port={{ item }} jump=DROP
when: step|int == 0
with_items:
- 6640
- 6653
- 6633
post_upgrade_tasks:
- name: Check service openvswitch is running
command: systemctl is-active --quiet openvswitch
tags: common
register: openvswitch_running
- name: Delete OVS groups and ports
shell: "sudo ovs-ofctl -O Openflow13 del-groups br-int; \
for tun_port in $(ovs-vsctl list-ports br-int | grep 'tun'); \
do; ovs-vsctl del-port br-int $(tun_port); done;"
when: (step|int == 0) and (openvswitch_running.rc == 0)
- name: Stop openvswitch service
when: (step|int == 1) and (openvswitch_running.rc == 0)
service: name=openvswitch state=stopped
- name: Unblock OVS port per compute node. #Delete previously added rule
iptables: chain=OUTPUT action=insert protocol=tcp destination_port={{ item }} jump=DROP state=absent
when: step|int == 2
with_items:
- 6640
- 6653
- 6633
- name: start openvswitch service
when: step|int == 3
service : name=openvswitch state=started
metadata_settings:
if:
- internal_tls_enabled

View File

@ -0,0 +1,16 @@
---
features:
- Add ODL upgradability
Steps of upgrade are as follows
1. Block OVS instances to connect to ODL done in upgrade_tasks
2. Set ODL upgrade flag to True done in upgrade_tasks
3. Start ODL. This is done via docker config step 1
4. Start Neutron re-sync triggered by starting of Neutron server
container in step 4 of docker config
5. Delete OVS groups and ports
6. Stop OVS
7. Unblock OVS ports
8. Start OVS
9. Unset ODL upgrade flag
Steps 5 to 9 are done in post_upgrade_steps