Add manual ovs upgrade script for workaround ovs upgrade issue
authorMathieu Bultel <mbultel@redhat.com>
Wed, 15 Feb 2017 15:36:17 +0000 (16:36 +0100)
committerMarios Andreou <marios@redhat.com>
Fri, 31 Mar 2017 15:24:19 +0000 (15:24 +0000)
When we upgrade OVS from 2.5 to 2.6, the postrun package update
restart the services and drop the connectivity
We need to push this manual upgrade script and executed to the
nodes for newton to ocata

The special case is needed for 2.5.0-14 specifically see related
bug for more info (or, older where the postun tries restart).
See related review at [1] for the minor update/manual upgrade.

Related-Bug: 1669714
Depends-On: I3227189691df85f265cf84bd4115d8d4c9f979f3
Co-Authored-By: Sofer Athlan-Guyot <sathlang@redhat.com>
[1] https://review.openstack.org/#/c/450607/

Change-Id: If998704b3c4199bbae8a1d068c31a71763f5c8a2

puppet/services/neutron-ovs-agent.yaml
puppet/services/neutron-ovs-dpdk-agent.yaml
puppet/services/opendaylight-ovs.yaml
puppet/services/openvswitch-upgrade.yaml [new file with mode: 0644]
releasenotes/notes/ovs-2.5-2.6-composable-upgrades-workaround-73f4e56127c910b4.yaml [new file with mode: 0644]

index 01471ba..ef2485d 100644 (file)
@@ -82,6 +82,9 @@ resources:
       DefaultPasswords: {get_param: DefaultPasswords}
       EndpointMap: {get_param: EndpointMap}
 
+  OpenVswitchUpgrade:
+    type: ./openvswitch-upgrade.yaml
+
 outputs:
   role_data:
     description: Role data for the Neutron OVS agent service.
@@ -121,16 +124,22 @@ outputs:
       step_config: |
         include ::tripleo::profile::base::neutron::ovs
       upgrade_tasks:
-        - name: Check if neutron_ovs_agent is deployed
-          command: systemctl is-enabled neutron-openvswitch-agent
-          tags: common
-          ignore_errors: True
-          register: neutron_ovs_agent_enabled
-        - name: "PreUpgrade step0,validation: Check service neutron-openvswitch-agent is running"
-          shell: /usr/bin/systemctl show 'neutron-openvswitch-agent' --property ActiveState | grep '\bactive\b'
-          when: neutron_ovs_agent_enabled.rc == 0
-          tags: step0,validation
-        - name: Stop neutron_ovs_agent service
-          tags: step1
-          when: neutron_ovs_agent_enabled.rc == 0
-          service: name=neutron-openvswitch-agent state=stopped
+        yaql:
+          expression: $.data.ovs_upgrade + $.data.neutron_ovs_upgrade
+          data:
+            ovs_upgrade:
+              get_attr: [OpenVswitchUpgrade, role_data, upgrade_tasks]
+            neutron_ovs_upgrade:
+              - name: Check if neutron_ovs_agent is deployed
+                command: systemctl is-enabled neutron-openvswitch-agent
+                tags: common
+                ignore_errors: True
+                register: neutron_ovs_agent_enabled
+              - name: "PreUpgrade step0,validation: Check service neutron-openvswitch-agent is running"
+                shell: /usr/bin/systemctl show 'neutron-openvswitch-agent' --property ActiveState | grep '\bactive\b'
+                when: neutron_ovs_agent_enabled.rc == 0
+                tags: step0,validation
+              - name: Stop neutron_ovs_agent service
+                tags: step1
+                when: neutron_ovs_agent_enabled.rc == 0
+                service: name=neutron-openvswitch-agent state=stopped
index e25bc49..efe7ba4 100644 (file)
@@ -62,6 +62,9 @@ resources:
       DefaultPasswords: {get_param: DefaultPasswords}
       EndpointMap: {get_param: EndpointMap}
 
+  OpenVswitchUpgrade:
+    type: ./openvswitch-upgrade.yaml
+
 outputs:
   role_data:
     description: Role data for the Neutron OVS DPDK Agent service.
@@ -79,3 +82,5 @@ outputs:
             vswitch::dpdk::socket_mem: {get_param: NeutronDpdkSocketMemory}
             vswitch::dpdk::driver_type: {get_param: NeutronDpdkDriverType}
       step_config: {get_attr: [NeutronOvsAgent, role_data, step_config]}
+      upgrade_tasks:
+        get_attr: [OpenVswitchUpgrade, role_data, upgrade_tasks]
index 3db0848..c63c586 100644 (file)
@@ -48,6 +48,10 @@ parameters:
     default: {}
     type: json
 
+resources:
+  OpenVswitchUpgrade:
+    type: ./openvswitch-upgrade.yaml
+
 outputs:
   role_data:
     description: Role data for the OpenDaylight service.
@@ -74,16 +78,22 @@ outputs:
       step_config: |
         include tripleo::profile::base::neutron::plugins::ovs::opendaylight
       upgrade_tasks:
-        - name: Check if openvswitch is deployed
-          command: systemctl is-enabled openvswitch
-          tags: common
-          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'
-          when: openvswitch_enabled.rc == 0
-          tags: step0,validation
-        - name: Stop openvswitch service
-          tags: step1
-          when: openvswitch_enabled.rc == 0
-          service: name=openvswitch state=stopped
+        yaql:
+          expression: $.data.ovs_upgrade + $.data.opendaylight_upgrade
+          data:
+            ovs_upgrade:
+              get_attr: [OpenVswitchUpgrade, role_data, upgrade_tasks]
+            opendaylight_upgrade:
+              - name: Check if openvswitch is deployed
+                command: systemctl is-enabled openvswitch
+                tags: common
+                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'
+                when: openvswitch_enabled.rc == 0
+                tags: step0,validation
+              - name: Stop openvswitch service
+                tags: step1
+                when: openvswitch_enabled.rc == 0
+                service: name=openvswitch state=stopped
diff --git a/puppet/services/openvswitch-upgrade.yaml b/puppet/services/openvswitch-upgrade.yaml
new file mode 100644 (file)
index 0000000..fea1ba9
--- /dev/null
@@ -0,0 +1,50 @@
+heat_template_version: ocata
+
+description: >
+  Openvswitch package special handling for upgrade.
+
+outputs:
+  role_data:
+    description: Upgrade task for special handling of Openvswitch (OVS) upgrade.
+    value:
+      service_name: openvswitch_upgrade
+      upgrade_tasks:
+        - name: Check openvswitch version.
+          tags: step2
+          register: ovs_version
+          ignore_errors: true
+          shell: rpm -qa | awk -F- '/^openvswitch-2/{print $2 "-" $3}'
+        - name: Check openvswitch packaging.
+          tags: step2
+          shell: rpm -q --scripts openvswitch | awk '/postuninstall/,/*/' | grep -q "systemctl.*try-restart"
+          register: ovs_packaging_issue
+          ignore_errors: true
+        - block:
+            - name: "Ensure empty directory: emptying."
+              file:
+                state: absent
+                path: /root/OVS_UPGRADE
+            - name: "Ensure empty directory: creating."
+              file:
+                state: directory
+                path: /root/OVS_UPGRADE
+                owner: root
+                group: root
+                mode: 0750
+            - name: Download OVS packages.
+              command: yumdownloader --destdir /root/OVS_UPGRADE --resolve openvswitch
+            - name: Get rpm list for manual upgrade of OVS.
+              shell: ls -1 /root/OVS_UPGRADE/*.rpm
+              register: ovs_list_of_rpms
+            - name: Manual upgrade of OVS
+              shell: |
+                rpm -U --test {{item}} 2>&1 | grep "already installed" || \
+                rpm -U --replacepkgs --notriggerun --nopostun {{item}};
+              args:
+                chdir: /root/OVS_UPGRADE
+              with_items:
+                - "{{ovs_list_of_rpms.stdout_lines}}"
+          tags: step2
+          when: "'2.5.0-14' in '{{ovs_version.stdout}}'
+                or
+                ovs_packaging_issue|succeeded"
diff --git a/releasenotes/notes/ovs-2.5-2.6-composable-upgrades-workaround-73f4e56127c910b4.yaml b/releasenotes/notes/ovs-2.5-2.6-composable-upgrades-workaround-73f4e56127c910b4.yaml
new file mode 100644 (file)
index 0000000..8c21082
--- /dev/null
@@ -0,0 +1,12 @@
+---
+issues:
+  - During the ovs upgrade for 2.5 to 2.6 we need to workaround the classic
+    yum update command by handling the upgrade of the package separately to not
+    loose the IPs and the connectivity on the nodes. The workaround is
+    discussed here https://bugs.launchpad.net/tripleo/+bug/1669714
+upgrade:
+  - The upgrade from openvswitch 2.5 to 2.6 is handled gracefully and there should
+    be no user impact in particular no restart of the openvswitch service. For more
+    information please see the related bug above which also links the relevant code reviews.
+    The workaround (transparent to the user/doesn't require any input) is to download the OVS
+    package and install with --nopostun and --notriggerun options provided by the rpm binary.