improve migration script
Change-Id: I7bacbdd9a0a0914be507758436f7b9ceb465654c
This commit is contained in:
parent
b2ff372535
commit
dacf857145
@ -35,31 +35,30 @@ nodes. For more information, see :ref:`cli-os-migrate-cfg-ssh`.
|
||||
|
||||
# Provide usage
|
||||
usage() {
|
||||
echo "Usage: $0 VM_ID"
|
||||
exit 1
|
||||
echo "Usage: $0 VM_ID"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[[ $# -eq 0 ]] && usage
|
||||
|
||||
# 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
|
||||
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
|
||||
echo " instance migrated and resized."
|
||||
echo;
|
||||
|
||||
# Show the details for the VM
|
||||
echo "Updated instance details:"
|
||||
openstack server show $VM_ID
|
||||
echo "Instance details:"
|
||||
openstack server show ${VM_ID}
|
||||
|
||||
# Migrate the VM to an alternate hypervisor
|
||||
echo -n "Migrating instance to alternate host "
|
||||
openstack server migrate ${VM_ID}
|
||||
while [[ "$(openstack server show ${VM_ID} -f value -c status)" != "VERIFY_RESIZE" ]]; do
|
||||
echo -n "."
|
||||
sleep 2
|
||||
done
|
||||
openstack server resize --confirm ${VM_ID}
|
||||
echo " instance migrated and resized."
|
||||
|
||||
# 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."
|
||||
|
Loading…
Reference in New Issue
Block a user