| ... | ... |
@@ -70,9 +70,6 @@ TOKEN=`curl -s -d "{\"auth\":{\"passwordCredentials\": {\"username\": \"$NOVA_U
|
| 70 | 70 |
# List servers for tenant: |
| 71 | 71 |
nova list |
| 72 | 72 |
|
| 73 |
-# List of flavors: |
|
| 74 |
-nova flavor-list |
|
| 75 |
- |
|
| 76 | 73 |
# Images |
| 77 | 74 |
# ------ |
| 78 | 75 |
|
| ... | ... |
@@ -82,8 +79,38 @@ nova image-list |
| 82 | 82 |
# But we recommend using glance directly |
| 83 | 83 |
glance -A $TOKEN index |
| 84 | 84 |
|
| 85 |
-# show details of the active servers:: |
|
| 86 |
-# |
|
| 87 |
-# nova show 1234 |
|
| 88 |
-# |
|
| 89 |
-nova list | grep ACTIVE | cut -d \| -f2 | xargs -n1 nova show |
|
| 85 |
+# Let's grab the id of the first AMI image to launch |
|
| 86 |
+IMAGE=`glance -A $TOKEN index | egrep ami | cut -d" " -f1` |
|
| 87 |
+ |
|
| 88 |
+ |
|
| 89 |
+# Flavors |
|
| 90 |
+# ------- |
|
| 91 |
+ |
|
| 92 |
+# List of flavors: |
|
| 93 |
+nova flavor-list |
|
| 94 |
+ |
|
| 95 |
+# and grab the first flavor in the list to launch |
|
| 96 |
+FLAVOR=`nova flavor-list | head -n 4 | tail -n 1 | cut -d"|" -f2` |
|
| 97 |
+ |
|
| 98 |
+NAME="firstpost" |
|
| 99 |
+ |
|
| 100 |
+nova boot --flavor $FLAVOR --image $IMAGE $NAME |
|
| 101 |
+ |
|
| 102 |
+# let's give it 10 seconds to launch |
|
| 103 |
+sleep 10 |
|
| 104 |
+ |
|
| 105 |
+# check that the status is active |
|
| 106 |
+nova show $NAME | grep status | grep -q ACTIVE |
|
| 107 |
+ |
|
| 108 |
+# get the IP of the server |
|
| 109 |
+IP=`nova show $NAME | grep "private network" | cut -d"|" -f3` |
|
| 110 |
+ |
|
| 111 |
+# ping it once (timeout of a second) |
|
| 112 |
+ping -c1 -w1 $IP |
|
| 113 |
+ |
|
| 114 |
+# shutdown the server |
|
| 115 |
+nova delete $NAME |
|
| 116 |
+ |
|
| 117 |
+# FIXME: validate shutdown within 5 seconds |
|
| 118 |
+# (nova show $NAME returns 1 or status != ACTIVE)? |
|
| 119 |
+ |