Change `glance image-create` commands to use `openstack image create`,
in an effort to unify the CLI.
Change-Id: I96cef118daf931b648c0483525ac7d2287fec2e0
... | ... |
@@ -85,7 +85,7 @@ function upload_image { |
85 | 85 |
# OpenVZ-format images are provided as .tar.gz, but not decompressed prior to loading |
86 | 86 |
if [[ "$image_url" =~ 'openvz' ]]; then |
87 | 87 |
image_name="${image_fname%.tar.gz}" |
88 |
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name" --is-public=True --container-format ami --disk-format ami < "${image}" |
|
88 |
+ openstack --os-token $token --os-url http://$GLANCE_HOSTPORT image create "$image_name" --public --container-format ami --disk-format ami < "${image}" |
|
89 | 89 |
return |
90 | 90 |
fi |
91 | 91 |
|
... | ... |
@@ -196,7 +196,7 @@ function upload_image { |
196 | 196 |
vmdk_adapter_type="${props[1]:-$vmdk_adapter_type}" |
197 | 197 |
vmdk_net_adapter="${props[2]:-$vmdk_net_adapter}" |
198 | 198 |
|
199 |
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name" --is-public=True --container-format bare --disk-format vmdk --property vmware_disktype="$vmdk_disktype" --property vmware_adaptertype="$vmdk_adapter_type" --property hw_vif_model="$vmdk_net_adapter" < "${image}" |
|
199 |
+ openstack --os-token $token --os-url http://$GLANCE_HOSTPORT image create "$image_name" --public --container-format bare --disk-format vmdk --property vmware_disktype="$vmdk_disktype" --property vmware_adaptertype="$vmdk_adapter_type" --property hw_vif_model="$vmdk_net_adapter" < "${image}" |
|
200 | 200 |
return |
201 | 201 |
fi |
202 | 202 |
|
... | ... |
@@ -212,11 +212,11 @@ function upload_image { |
212 | 212 |
# directly from volume. |
213 | 213 |
force_vm_mode="--property vm_mode=xen" |
214 | 214 |
fi |
215 |
- glance \ |
|
216 |
- --os-auth-token $token \ |
|
217 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
218 |
- image-create \ |
|
219 |
- --name "$image_name" --is-public=True \ |
|
215 |
+ openstack \ |
|
216 |
+ --os-token $token \ |
|
217 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
218 |
+ image create \ |
|
219 |
+ "$image_name" --public \ |
|
220 | 220 |
--container-format=ovf --disk-format=vhd \ |
221 | 221 |
$force_vm_mode < "${image}" |
222 | 222 |
return |
... | ... |
@@ -227,11 +227,11 @@ function upload_image { |
227 | 227 |
# Setting metadata, so PV mode is used. |
228 | 228 |
if [[ "$image_url" =~ '.xen-raw.tgz' ]]; then |
229 | 229 |
image_name="${image_fname%.xen-raw.tgz}" |
230 |
- glance \ |
|
231 |
- --os-auth-token $token \ |
|
232 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
233 |
- image-create \ |
|
234 |
- --name "$image_name" --is-public=True \ |
|
230 |
+ openstack \ |
|
231 |
+ --os-token $token \ |
|
232 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
233 |
+ image create \ |
|
234 |
+ "$image_name" --public \ |
|
235 | 235 |
--container-format=tgz --disk-format=raw \ |
236 | 236 |
--property vm_mode=xen < "${image}" |
237 | 237 |
return |
... | ... |
@@ -298,9 +298,9 @@ function upload_image { |
298 | 298 |
|
299 | 299 |
if [ "$container_format" = "bare" ]; then |
300 | 300 |
if [ "$unpack" = "zcat" ]; then |
301 |
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name" $img_property --is-public True --container-format=$container_format --disk-format $disk_format < <(zcat --force "${image}") |
|
301 |
+ openstack --os-token $token --os-url http://$GLANCE_HOSTPORT image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < <(zcat --force "${image}") |
|
302 | 302 |
else |
303 |
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name" $img_property --is-public True --container-format=$container_format --disk-format $disk_format < "${image}" |
|
303 |
+ openstack --os-token $token --os-url http://$GLANCE_HOSTPORT image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < "${image}" |
|
304 | 304 |
fi |
305 | 305 |
else |
306 | 306 |
# Use glance client to add the kernel the root filesystem. |
... | ... |
@@ -308,12 +308,12 @@ function upload_image { |
308 | 308 |
# kernel for use when uploading the root filesystem. |
309 | 309 |
local kernel_id="" ramdisk_id=""; |
310 | 310 |
if [ -n "$kernel" ]; then |
311 |
- kernel_id=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name-kernel" $img_property --is-public True --container-format aki --disk-format aki < "$kernel" | grep ' id ' | get_field 2) |
|
311 |
+ kernel_id=$(openstack --os-token $token --os-url http://$GLANCE_HOSTPORT image create "$image_name-kernel" $img_property --public --container-format aki --disk-format aki < "$kernel" | grep ' id ' | get_field 2) |
|
312 | 312 |
fi |
313 | 313 |
if [ -n "$ramdisk" ]; then |
314 |
- ramdisk_id=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$image_name-ramdisk" $img_property --is-public True --container-format ari --disk-format ari < "$ramdisk" | grep ' id ' | get_field 2) |
|
314 |
+ ramdisk_id=$(openstack --os-token $token --os-url http://$GLANCE_HOSTPORT image create "$image_name-ramdisk" $img_property --public --container-format ari --disk-format ari < "$ramdisk" | grep ' id ' | get_field 2) |
|
315 | 315 |
fi |
316 |
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "${image_name%.img}" $img_property --is-public True --container-format ami --disk-format ami ${kernel_id:+--property kernel_id=$kernel_id} ${ramdisk_id:+--property ramdisk_id=$ramdisk_id} < "${image}" |
|
316 |
+ openstack --os-token $token --os-url http://$GLANCE_HOSTPORT image create "${image_name%.img}" $img_property --public --container-format ami --disk-format ami ${kernel_id:+--property kernel_id=$kernel_id} ${ramdisk_id:+--property ramdisk_id=$ramdisk_id} < "${image}" |
|
317 | 317 |
fi |
318 | 318 |
} |
319 | 319 |
|
... | ... |
@@ -229,19 +229,19 @@ function upload_baremetal_deploy { |
229 | 229 |
fi |
230 | 230 |
|
231 | 231 |
# load them into glance |
232 |
- BM_DEPLOY_KERNEL_ID=$(glance \ |
|
233 |
- --os-auth-token $token \ |
|
234 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
235 |
- image-create \ |
|
236 |
- --name $BM_DEPLOY_KERNEL \ |
|
237 |
- --is-public True --disk-format=aki \ |
|
232 |
+ BM_DEPLOY_KERNEL_ID=$(openstack \ |
|
233 |
+ --os-token $token \ |
|
234 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
235 |
+ image create \ |
|
236 |
+ $BM_DEPLOY_KERNEL \ |
|
237 |
+ --public --disk-format=aki \ |
|
238 | 238 |
< $TOP_DIR/files/$BM_DEPLOY_KERNEL | grep ' id ' | get_field 2) |
239 |
- BM_DEPLOY_RAMDISK_ID=$(glance \ |
|
240 |
- --os-auth-token $token \ |
|
241 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
242 |
- image-create \ |
|
243 |
- --name $BM_DEPLOY_RAMDISK \ |
|
244 |
- --is-public True --disk-format=ari \ |
|
239 |
+ BM_DEPLOY_RAMDISK_ID=$(openstack \ |
|
240 |
+ --os-token $token \ |
|
241 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
242 |
+ image create \ |
|
243 |
+ $BM_DEPLOY_RAMDISK \ |
|
244 |
+ --public --disk-format=ari \ |
|
245 | 245 |
< $TOP_DIR/files/$BM_DEPLOY_RAMDISK | grep ' id ' | get_field 2) |
246 | 246 |
} |
247 | 247 |
|
... | ... |
@@ -284,19 +284,19 @@ function extract_and_upload_k_and_r_from_image { |
284 | 284 |
OUT_RAMDISK=${out##*,} |
285 | 285 |
|
286 | 286 |
# load them into glance |
287 |
- KERNEL_ID=$(glance \ |
|
288 |
- --os-auth-token $token \ |
|
289 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
290 |
- image-create \ |
|
291 |
- --name $image_name-kernel \ |
|
292 |
- --is-public True --disk-format=aki \ |
|
287 |
+ KERNEL_ID=$(openstack \ |
|
288 |
+ --os-token $token \ |
|
289 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
290 |
+ image create \ |
|
291 |
+ $image_name-kernel \ |
|
292 |
+ --public --disk-format=aki \ |
|
293 | 293 |
< $TOP_DIR/files/$OUT_KERNEL | grep ' id ' | get_field 2) |
294 |
- RAMDISK_ID=$(glance \ |
|
295 |
- --os-auth-token $token \ |
|
296 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
297 |
- image-create \ |
|
298 |
- --name $image_name-initrd \ |
|
299 |
- --is-public True --disk-format=ari \ |
|
294 |
+ RAMDISK_ID=$(openstack \ |
|
295 |
+ --os-token $token \ |
|
296 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
297 |
+ image create \ |
|
298 |
+ $image_name-initrd \ |
|
299 |
+ --public --disk-format=ari \ |
|
300 | 300 |
< $TOP_DIR/files/$OUT_RAMDISK | grep ' id ' | get_field 2) |
301 | 301 |
} |
302 | 302 |
|
... | ... |
@@ -362,18 +362,18 @@ function upload_baremetal_image { |
362 | 362 |
if [ "$CONTAINER_FORMAT" = "bare" ]; then |
363 | 363 |
extract_and_upload_k_and_r_from_image $token $IMAGE |
364 | 364 |
elif [ "$CONTAINER_FORMAT" = "ami" ]; then |
365 |
- KERNEL_ID=$(glance \ |
|
366 |
- --os-auth-token $token \ |
|
367 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
368 |
- image-create \ |
|
369 |
- --name "$IMAGE_NAME-kernel" --is-public True \ |
|
365 |
+ KERNEL_ID=$(openstack \ |
|
366 |
+ --os-token $token \ |
|
367 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
368 |
+ image create \ |
|
369 |
+ "$IMAGE_NAME-kernel" --public \ |
|
370 | 370 |
--container-format aki \ |
371 | 371 |
--disk-format aki < "$KERNEL" | grep ' id ' | get_field 2) |
372 |
- RAMDISK_ID=$(glance \ |
|
373 |
- --os-auth-token $token \ |
|
374 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
375 |
- image-create \ |
|
376 |
- --name "$IMAGE_NAME-ramdisk" --is-public True \ |
|
372 |
+ RAMDISK_ID=$(openstack \ |
|
373 |
+ --os-token $token \ |
|
374 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
375 |
+ image create \ |
|
376 |
+ "$IMAGE_NAME-ramdisk" --public \ |
|
377 | 377 |
--container-format ari \ |
378 | 378 |
--disk-format ari < "$RAMDISK" | grep ' id ' | get_field 2) |
379 | 379 |
else |
... | ... |
@@ -381,11 +381,11 @@ function upload_baremetal_image { |
381 | 381 |
return |
382 | 382 |
fi |
383 | 383 |
|
384 |
- glance \ |
|
385 |
- --os-auth-token $token \ |
|
386 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
387 |
- image-create \ |
|
388 |
- --name "${IMAGE_NAME%.img}" --is-public True \ |
|
384 |
+ openstack \ |
|
385 |
+ --os-token $token \ |
|
386 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
387 |
+ image create \ |
|
388 |
+ "${IMAGE_NAME%.img}" --public \ |
|
389 | 389 |
--container-format $CONTAINER_FORMAT \ |
390 | 390 |
--disk-format $DISK_FORMAT \ |
391 | 391 |
${KERNEL_ID:+--property kernel_id=$KERNEL_ID} \ |
... | ... |
@@ -486,19 +486,19 @@ function upload_baremetal_ironic_deploy { |
486 | 486 |
fi |
487 | 487 |
|
488 | 488 |
# load them into glance |
489 |
- IRONIC_DEPLOY_KERNEL_ID=$(glance \ |
|
490 |
- --os-auth-token $token \ |
|
491 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
492 |
- image-create \ |
|
493 |
- --name $(basename $IRONIC_DEPLOY_KERNEL_PATH) \ |
|
494 |
- --is-public True --disk-format=aki \ |
|
489 |
+ IRONIC_DEPLOY_KERNEL_ID=$(openstack \ |
|
490 |
+ --os-token $token \ |
|
491 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
492 |
+ image create \ |
|
493 |
+ $(basename $IRONIC_DEPLOY_KERNEL_PATH) \ |
|
494 |
+ --public --disk-format=aki \ |
|
495 | 495 |
< $IRONIC_DEPLOY_KERNEL_PATH | grep ' id ' | get_field 2) |
496 |
- IRONIC_DEPLOY_RAMDISK_ID=$(glance \ |
|
497 |
- --os-auth-token $token \ |
|
498 |
- --os-image-url http://$GLANCE_HOSTPORT \ |
|
499 |
- image-create \ |
|
500 |
- --name $(basename $IRONIC_DEPLOY_RAMDISK_PATH) \ |
|
501 |
- --is-public True --disk-format=ari \ |
|
496 |
+ IRONIC_DEPLOY_RAMDISK_ID=$(openstack \ |
|
497 |
+ --os-token $token \ |
|
498 |
+ --os-url http://$GLANCE_HOSTPORT \ |
|
499 |
+ image create \ |
|
500 |
+ $(basename $IRONIC_DEPLOY_RAMDISK_PATH) \ |
|
501 |
+ --public --disk-format=ari \ |
|
502 | 502 |
< $IRONIC_DEPLOY_RAMDISK_PATH | grep ' id ' | get_field 2) |
503 | 503 |
} |
504 | 504 |
|