Skip to content

Instantly share code, notes, and snippets.

@thurloat
Created March 3, 2015 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thurloat/be869e4aafb741499007 to your computer and use it in GitHub Desktop.
Save thurloat/be869e4aafb741499007 to your computer and use it in GitHub Desktop.
demo manual offline snapshot in openstack
#!/bin/bash
# ./test_off.sh <uuid> <snap_name>
uuid=$1
snapname=$2
nova stop $uuid
while true; do
status=$(nova show $uuid | grep vm_state | awk '{ print $4 }')
echo $status
if [ "$status" == "stopped" ]; then
break;
fi
sleep 1
done
echo "Off"
sleep 3
nova image-create $uuid $snapname
while true; do
status=$(nova show $uuid | grep task_state | awk '{ print $4 }')
echo $status
if [ "$status" == "-" ]; then
break;
fi
sleep 2
done
nova start $uuid
( ( sleep 2 && nova show $uuid ) & )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment