[FFWD] Propose a fix for node_upgrade_pre.sh.j2

If overcloud already exist and migration needed before compute upgrade
Which means workload_launch=false and compute_present=true
compute_upgrade_pre.sh is not created.
This fix allows the above parameter mix to create and run
compute_upgrade_pre.sh

Adding condition check in compute_upgrade_pre.sh
1) If no active computes on host, live migration will not occur
2) Adding --all param to see tenant vms on compute

Change-Id: I3cd33592a625cb8d8dabd0ad09e5f95e1e3be556
This commit is contained in:
Yariv Rachmani 2020-11-08 17:37:04 +02:00
parent f3278cb056
commit b8d3218d1e
3 changed files with 11 additions and 9 deletions

View File

@ -4,9 +4,7 @@
when: pcs_present
- name: create compute pre upgrade script for {{ item }}
when:
- compute_present|bool
- workload_launch|bool
when: (compute_present | bool) or (workload_launch | bool)
vars:
node_name: "{{ item | reject('none') | join(',') }}"
template:

View File

@ -12,9 +12,7 @@
tags: ffu_overcloud_system_upgrade
- name: run the pre upgrade script for the host {{ host }}
when:
- compute_present|bool
- workload_launch|bool
when: (compute_present | bool) or (workload_launch | bool)
shell: |
set -o pipefail
./{{ host }}_upgrade_pre.sh 2>&1 {{ timestamper_cmd }} >> {{ host }}_upgrade_pre.log

View File

@ -2,13 +2,19 @@
source {{ overcloud_rc }}
## Get exact hostname
HOST=$(openstack compute service list -f value -c Host | grep {{ node_name }} )
nova host-evacuate-live ${HOST}
INSTANCE_COUNT=$(openstack server list --all --host ${HOST} -f json | jq -r -c '[.[] | select(.Status | contains("ACTIVE"))] | length')
if [ $INSTANCE_COUNT != 0 ]; then
nova host-evacuate-live ${HOST}
else
echo "No vms in active state on ${HOST}"
fi
timeout_seconds=120
elapsed_seconds=0
while true; do
while [ $INSTANCE_COUNT != 0 ]; do
echo "Waiting for ${HOST} to get quiesced ..."
INSTANCE_COUNT=$(openstack server list --host ${HOST} -f json | jq -r -c '[.[] | select(.Status | contains("ACTIVE") or contains("PAUSED") or contains("MIGRATING"))] | length')
INSTANCE_COUNT=$(openstack server list --all --host ${HOST} -f json | jq -r -c '[.[] | select(.Status | contains("ACTIVE") or contains("PAUSED") or contains("MIGRATING"))] | length')
if [ $INSTANCE_COUNT == 0 ]; then
break
fi