Ensure migrate all the VMs before upgrade the compute

Currently, there is one case that escape from the nest if/else
statements. When there are instances to migrate and there is no
DO_NO_MIGRATE_IDs, there was returing 0.

This patch fixed that and makes the script return 1, because
there are VMs to migrate.

This patch also removed the second "host_quiesced" called, as
it was previously executed on the while statement.

Co-authored-by: Daniel Mats Niklas Bengtsson <dbengt@redhat.com>
Change-Id: Idfb9899cc9a599bff2e335c74edd7ee4f74e8c06
This commit is contained in:
Juan Badia Payno 2022-02-23 17:17:21 +01:00
parent cebf24cc24
commit 305d9fb0d8

View File

@ -16,6 +16,9 @@ host_quiesced() {
echo "Guests still pending migration"
return 1
fi
else
echo "Guests still pending migration"
return 1
fi
else
echo "All ACTIVE guests are off the host"
@ -82,9 +85,6 @@ timeout_seconds=$(( $MIGRATION_TIMEOUT * ( ${#VM_IDs[@]} + 1 ) ))
elapsed_seconds=0
while ! host_quiesced; do
echo "Waiting for ${HOST} to get quiesced ..."
if host_quiesced; then
break
fi
sleep 3
(( elapsed_seconds += 3 ))
if [ $elapsed_seconds -ge $timeout_seconds ]; then