Exercises use nova volume-* commands still. This works fine,
however moving forward now that cinder is the default volume service
we should use the cinderclient explicitly for the applicable calls.
Attach/Detach are still novaclient commands, however the others
(create, delete, list, etc) should be cinderclient.
Change-Id: I336de1b69a32eee6c91655b0a5bf8541b243f2f0
... | ... |
@@ -95,7 +95,7 @@ nova keypair-add $KEY_NAME > $KEY_FILE |
95 | 95 |
chmod 600 $KEY_FILE |
96 | 96 |
|
97 | 97 |
# Delete the old volume |
98 |
-nova volume-delete $VOL_NAME || true |
|
98 |
+cinder delete $VOL_NAME || true |
|
99 | 99 |
|
100 | 100 |
# Free every floating ips - setting FREE_ALL_FLOATING_IPS=True in localrc will make life easier for testers |
101 | 101 |
if [ "$FREE_ALL_FLOATING_IPS" = "True" ]; then |
... | ... |
@@ -112,15 +112,15 @@ if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova floating-ip-list | grep -q $ |
112 | 112 |
fi |
113 | 113 |
|
114 | 114 |
# Create the bootable volume |
115 |
-nova volume-create --display_name=$VOL_NAME --image-id $IMAGE 1 |
|
115 |
+cinder create --display_name=$VOL_NAME --image-id $IMAGE 1 |
|
116 | 116 |
|
117 | 117 |
# Wait for volume to activate |
118 |
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then |
|
118 |
+if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then |
|
119 | 119 |
echo "Volume $VOL_NAME not created" |
120 | 120 |
exit 1 |
121 | 121 |
fi |
122 | 122 |
|
123 |
-VOLUME_ID=`nova volume-list | grep $VOL_NAME | get_field 1` |
|
123 |
+VOLUME_ID=`cinder list | grep $VOL_NAME | get_field 1` |
|
124 | 124 |
|
125 | 125 |
# Boot instance from volume! This is done with the --block_device_mapping param. |
126 | 126 |
# The format of mapping is: |
... | ... |
@@ -152,13 +152,13 @@ nova delete $VOL_INSTANCE_NAME || \ |
152 | 152 |
die "Failure deleting instance volume $VOL_INSTANCE_NAME" |
153 | 153 |
|
154 | 154 |
# Wait till our volume is no longer in-use |
155 |
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then |
|
155 |
+if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then |
|
156 | 156 |
echo "Volume $VOL_NAME not created" |
157 | 157 |
exit 1 |
158 | 158 |
fi |
159 | 159 |
|
160 | 160 |
# Delete the volume |
161 |
-nova volume-delete $VOL_NAME || \ |
|
161 |
+cinder delete $VOL_NAME || \ |
|
162 | 162 |
die "Failure deleting volume $VOLUME_NAME" |
163 | 163 |
|
164 | 164 |
# De-allocate the floating ip |
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
|
3 | 3 |
# **volumes.sh** |
4 | 4 |
|
5 |
-# Test nova volumes with the nova command from python-novaclient |
|
5 |
+# Test cinder volumes with the cinder command from python-cinderclient |
|
6 | 6 |
|
7 | 7 |
echo "*********************************************************************" |
8 | 8 |
echo "Begin DevStack Exercise: $0" |
... | ... |
@@ -131,28 +131,28 @@ ping_check "$PRIVATE_NETWORK_NAME" $IP $BOOT_TIMEOUT |
131 | 131 |
VOL_NAME="myvol-$(openssl rand -hex 4)" |
132 | 132 |
|
133 | 133 |
# Verify it doesn't exist |
134 |
-if [[ -n "`nova volume-list | grep $VOL_NAME | head -1 | get_field 2`" ]]; then |
|
134 |
+if [[ -n "`cinder list | grep $VOL_NAME | head -1 | get_field 2`" ]]; then |
|
135 | 135 |
echo "Volume $VOL_NAME already exists" |
136 | 136 |
exit 1 |
137 | 137 |
fi |
138 | 138 |
|
139 | 139 |
# Create a new volume |
140 |
-nova volume-create --display_name $VOL_NAME --display_description "test volume: $VOL_NAME" 1 |
|
140 |
+cinder create --display_name $VOL_NAME --display_description "test volume: $VOL_NAME" 1 |
|
141 | 141 |
if [[ $? != 0 ]]; then |
142 | 142 |
echo "Failure creating volume $VOL_NAME" |
143 | 143 |
exit 1 |
144 | 144 |
fi |
145 | 145 |
|
146 | 146 |
start_time=`date +%s` |
147 |
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then |
|
147 |
+if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then |
|
148 | 148 |
echo "Volume $VOL_NAME not created" |
149 | 149 |
exit 1 |
150 | 150 |
fi |
151 | 151 |
end_time=`date +%s` |
152 |
-echo "Completed volume-create in $((end_time - start_time)) seconds" |
|
152 |
+echo "Completed cinder create in $((end_time - start_time)) seconds" |
|
153 | 153 |
|
154 | 154 |
# Get volume ID |
155 |
-VOL_ID=`nova volume-list | grep $VOL_NAME | head -1 | get_field 1` |
|
155 |
+VOL_ID=`cinder list | grep $VOL_NAME | head -1 | get_field 1` |
|
156 | 156 |
die_if_not_set VOL_ID "Failure retrieving volume ID for $VOL_NAME" |
157 | 157 |
|
158 | 158 |
# Attach to server |
... | ... |
@@ -160,14 +160,14 @@ DEVICE=/dev/vdb |
160 | 160 |
start_time=`date +%s` |
161 | 161 |
nova volume-attach $VM_UUID $VOL_ID $DEVICE || \ |
162 | 162 |
die "Failure attaching volume $VOL_NAME to $NAME" |
163 |
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep in-use; do sleep 1; done"; then |
|
163 |
+if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep in-use; do sleep 1; done"; then |
|
164 | 164 |
echo "Volume $VOL_NAME not attached to $NAME" |
165 | 165 |
exit 1 |
166 | 166 |
fi |
167 | 167 |
end_time=`date +%s` |
168 | 168 |
echo "Completed volume-attach in $((end_time - start_time)) seconds" |
169 | 169 |
|
170 |
-VOL_ATTACH=`nova volume-list | grep $VOL_NAME | head -1 | get_field -1` |
|
170 |
+VOL_ATTACH=`cinder list | grep $VOL_NAME | head -1 | get_field -1` |
|
171 | 171 |
die_if_not_set VOL_ATTACH "Failure retrieving $VOL_NAME status" |
172 | 172 |
if [[ "$VOL_ATTACH" != $VM_UUID ]]; then |
173 | 173 |
echo "Volume not attached to correct instance" |
... | ... |
@@ -177,7 +177,7 @@ fi |
177 | 177 |
# Detach volume |
178 | 178 |
start_time=`date +%s` |
179 | 179 |
nova volume-detach $VM_UUID $VOL_ID || die "Failure detaching volume $VOL_NAME from $NAME" |
180 |
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then |
|
180 |
+if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then |
|
181 | 181 |
echo "Volume $VOL_NAME not detached from $NAME" |
182 | 182 |
exit 1 |
183 | 183 |
fi |
... | ... |
@@ -186,13 +186,13 @@ echo "Completed volume-detach in $((end_time - start_time)) seconds" |
186 | 186 |
|
187 | 187 |
# Delete volume |
188 | 188 |
start_time=`date +%s` |
189 |
-nova volume-delete $VOL_ID || die "Failure deleting volume $VOL_NAME" |
|
190 |
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME; do sleep 1; done"; then |
|
189 |
+cinder delete $VOL_ID || die "Failure deleting volume $VOL_NAME" |
|
190 |
+if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME; do sleep 1; done"; then |
|
191 | 191 |
echo "Volume $VOL_NAME not deleted" |
192 | 192 |
exit 1 |
193 | 193 |
fi |
194 | 194 |
end_time=`date +%s` |
195 |
-echo "Completed volume-delete in $((end_time - start_time)) seconds" |
|
195 |
+echo "Completed cinder delete in $((end_time - start_time)) seconds" |
|
196 | 196 |
|
197 | 197 |
# Shutdown the server |
198 | 198 |
nova delete $VM_UUID || die "Failure deleting instance $NAME" |