improve migration script

Change-Id: I7bacbdd9a0a0914be507758436f7b9ceb465654c
This commit is contained in:
Marcus Furlong 2018-08-10 13:55:49 -04:00
parent b2ff372535
commit dacf857145
1 changed files with 18 additions and 19 deletions

View File

@ -40,26 +40,25 @@ nodes. For more information, see :ref:`cli-os-migrate-cfg-ssh`.
}
[[ $# -eq 0 ]] && usage
VM_ID=$1
# Show the details for the VM
echo "Instance details:"
openstack server show ${VM_ID}
# Migrate the VM to an alternate hypervisor
echo -n "Migrating instance to alternate host "
VM_ID=$1
openstack server migrate $VM_ID
VM_OUTPUT=$(openstack server show $VM_ID)
VM_STATUS=$(echo "$VM_OUTPUT" | grep status | awk '{print $4}')
while [[ "$VM_STATUS" != "VERIFY_RESIZE" ]]; do
openstack server migrate ${VM_ID}
while [[ "$(openstack server show ${VM_ID} -f value -c status)" != "VERIFY_RESIZE" ]]; do
echo -n "."
sleep 2
VM_OUTPUT=$(openstack server show $VM_ID)
VM_STATUS=$(echo "$VM_OUTPUT" | grep status | awk '{print $4}')
done
openstack server resize --confirm $VM_ID
openstack server resize --confirm ${VM_ID}
echo " instance migrated and resized."
echo;
# Show the details for the VM
echo "Updated instance details:"
openstack server show $VM_ID
# Show the details for the migrated VM
echo "Migrated instance details:"
openstack server show ${VM_ID}
# Pause to allow users to examine VM details
read -p "Pausing, press <enter> to exit."