diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index 9a1f36c618..a5568db33e 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -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 diff --git a/docker/services/opendaylight-api.yaml b/docker/services/opendaylight-api.yaml index dd83e2f601..3282023b50 100644 --- a/docker/services/opendaylight-api.yaml +++ b/docker/services/opendaylight-api.yaml @@ -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: | + + true + + 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 diff --git a/puppet/services/opendaylight-ovs.yaml b/puppet/services/opendaylight-ovs.yaml index 33d8fbce97..2b15757c3a 100644 --- a/puppet/services/opendaylight-ovs.yaml +++ b/puppet/services/opendaylight-ovs.yaml @@ -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 diff --git a/releasenotes/notes/odl_upgrade-f5540d242b9a6b52.yaml b/releasenotes/notes/odl_upgrade-f5540d242b9a6b52.yaml new file mode 100644 index 0000000000..45703d07b3 --- /dev/null +++ b/releasenotes/notes/odl_upgrade-f5540d242b9a6b52.yaml @@ -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 \ No newline at end of file