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

This commit is contained in:
Zuul 2021-01-07 00:22:44 +00:00 committed by Gerrit Code Review
commit 87be79e1c8
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

@ -21,9 +21,7 @@
openstack compute service set --disable --disable-reason FFWD "$HOST" nova-compute
- 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,14 +2,20 @@
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
INSTANCE_COUNT=$(openstack server list --host ${HOST} -f json | jq -r -c '[.[] | select(.Status | contains("ACTIVE") or contains("PAUSED") or contains("MIGRATING"))] | length')
timeout_seconds=$(( 60 * ( $INSTANCE_COUNT + 1 ) ))
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