From 5c206c2b7d3a983094daa9b6f383d72e396caf55 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Sat, 2 Aug 2014 20:32:31 -0400 Subject: [PATCH] Migrate from using glance image-list to openstackclient Modify instance of `glance image-list` to `openstack image list`, in an effort to migrate all commands to unified CLI. Change-Id: Ieef661d209606e088fbf6a3a394f9a6577667618 --- exercises/boot_from_volume.sh | 4 ++-- exercises/client-args.sh | 2 +- exercises/client-env.sh | 2 +- exercises/floating_ips.sh | 4 ++-- exercises/neutron-adv-test.sh | 2 +- exercises/volumes.sh | 4 ++-- lib/tempest | 2 ++ lib/trove | 2 +- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh index d7566856f5..a2ae275b04 100755 --- a/exercises/boot_from_volume.sh +++ b/exercises/boot_from_volume.sh @@ -71,10 +71,10 @@ nova list # ------ # List the images available -glance image-list +openstack image list # Grab the id of the image to launch -IMAGE=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) +IMAGE=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME" # Security Groups diff --git a/exercises/client-args.sh b/exercises/client-args.sh index b360f1e86a..2f85d98d8f 100755 --- a/exercises/client-args.sh +++ b/exercises/client-args.sh @@ -122,7 +122,7 @@ if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then STATUS_GLANCE="Skipped" else echo -e "\nTest Glance" - if glance $TENANT_ARG $ARGS image-list; then + if openstack $TENANT_ARG $ARGS image list; then STATUS_GLANCE="Succeeded" else STATUS_GLANCE="Failed" diff --git a/exercises/client-env.sh b/exercises/client-env.sh index cc518d9a06..4a0609a944 100755 --- a/exercises/client-env.sh +++ b/exercises/client-env.sh @@ -132,7 +132,7 @@ if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then STATUS_GLANCE="Skipped" else echo -e "\nTest Glance" - if glance image-list; then + if openstack image list; then STATUS_GLANCE="Succeeded" else STATUS_GLANCE="Failed" diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh index 7e90e5adaf..57f48e08b2 100755 --- a/exercises/floating_ips.sh +++ b/exercises/floating_ips.sh @@ -71,10 +71,10 @@ nova list # ------ # List the images available -glance image-list +openstack image list # Grab the id of the image to launch -IMAGE=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) +IMAGE=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME" # Security Groups diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh index 6679670aee..5b3281b16a 100755 --- a/exercises/neutron-adv-test.sh +++ b/exercises/neutron-adv-test.sh @@ -134,7 +134,7 @@ function foreach_tenant_net { } function get_image_id { - local IMAGE_ID=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) + local IMAGE_ID=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) die_if_not_set $LINENO IMAGE_ID "Failure retrieving IMAGE_ID" echo "$IMAGE_ID" } diff --git a/exercises/volumes.sh b/exercises/volumes.sh index 1dff6a41ab..504fba1a04 100755 --- a/exercises/volumes.sh +++ b/exercises/volumes.sh @@ -68,10 +68,10 @@ nova list # ------ # List the images available -glance image-list +openstack image list # Grab the id of the image to launch -IMAGE=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) +IMAGE=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME" # Security Groups diff --git a/lib/tempest b/lib/tempest index 5ad2572913..3be8e29bf2 100644 --- a/lib/tempest +++ b/lib/tempest @@ -108,6 +108,8 @@ function configure_tempest { image_uuid_alt="$IMAGE_UUID" fi images+=($IMAGE_UUID) + # TODO(stevemar): update this command to use openstackclient's `openstack image list` + # when it supports listing by status. done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }') case "${#images[*]}" in diff --git a/lib/trove b/lib/trove index 6877d0f505..4b3c3b1931 100644 --- a/lib/trove +++ b/lib/trove @@ -211,7 +211,7 @@ function init_trove { # The image is uploaded by stack.sh -- see $IMAGE_URLS handling GUEST_IMAGE_NAME=$(basename "$TROVE_GUEST_IMAGE_URL") GUEST_IMAGE_NAME=${GUEST_IMAGE_NAME%.*} - TROVE_GUEST_IMAGE_ID=$(glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-list | grep "${GUEST_IMAGE_NAME}" | get_field 1) + TROVE_GUEST_IMAGE_ID=$(openstack --os-token $TOKEN --os-url http://$GLANCE_HOSTPORT image list | grep "${GUEST_IMAGE_NAME}" | get_field 1) if [ -z "$TROVE_GUEST_IMAGE_ID" ]; then # If no glance id is found, skip remaining setup echo "Datastore ${TROVE_DATASTORE_TYPE} will not be created: guest image ${GUEST_IMAGE_NAME} not found."