Browse code

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

Steve Martinelli authored on 2014/08/03 09:32:31
Showing 8 changed files
... ...
@@ -71,10 +71,10 @@ nova list
71 71
 # ------
72 72
 
73 73
 # List the images available
74
-glance image-list
74
+openstack image list
75 75
 
76 76
 # Grab the id of the image to launch
77
-IMAGE=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
77
+IMAGE=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
78 78
 die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME"
79 79
 
80 80
 # Security Groups
... ...
@@ -122,7 +122,7 @@ if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
122 122
         STATUS_GLANCE="Skipped"
123 123
     else
124 124
         echo -e "\nTest Glance"
125
-        if glance $TENANT_ARG $ARGS image-list; then
125
+        if openstack $TENANT_ARG $ARGS image list; then
126 126
             STATUS_GLANCE="Succeeded"
127 127
         else
128 128
             STATUS_GLANCE="Failed"
... ...
@@ -132,7 +132,7 @@ if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
132 132
         STATUS_GLANCE="Skipped"
133 133
     else
134 134
         echo -e "\nTest Glance"
135
-        if glance image-list; then
135
+        if openstack image list; then
136 136
             STATUS_GLANCE="Succeeded"
137 137
         else
138 138
             STATUS_GLANCE="Failed"
... ...
@@ -71,10 +71,10 @@ nova list
71 71
 # ------
72 72
 
73 73
 # List the images available
74
-glance image-list
74
+openstack image list
75 75
 
76 76
 # Grab the id of the image to launch
77
-IMAGE=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
77
+IMAGE=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
78 78
 die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME"
79 79
 
80 80
 # Security Groups
... ...
@@ -134,7 +134,7 @@ function foreach_tenant_net {
134 134
 }
135 135
 
136 136
 function get_image_id {
137
-    local IMAGE_ID=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
137
+    local IMAGE_ID=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
138 138
     die_if_not_set $LINENO IMAGE_ID "Failure retrieving IMAGE_ID"
139 139
     echo "$IMAGE_ID"
140 140
 }
... ...
@@ -68,10 +68,10 @@ nova list
68 68
 # ------
69 69
 
70 70
 # List the images available
71
-glance image-list
71
+openstack image list
72 72
 
73 73
 # Grab the id of the image to launch
74
-IMAGE=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
74
+IMAGE=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1)
75 75
 die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME"
76 76
 
77 77
 # Security Groups
... ...
@@ -108,6 +108,8 @@ function configure_tempest {
108 108
             image_uuid_alt="$IMAGE_UUID"
109 109
         fi
110 110
         images+=($IMAGE_UUID)
111
+    # TODO(stevemar): update this command to use openstackclient's `openstack image list`
112
+    # when it supports listing by status.
111 113
     done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
112 114
 
113 115
     case "${#images[*]}" in
... ...
@@ -211,7 +211,7 @@ function init_trove {
211 211
     # The image is uploaded by stack.sh -- see $IMAGE_URLS handling
212 212
     GUEST_IMAGE_NAME=$(basename "$TROVE_GUEST_IMAGE_URL")
213 213
     GUEST_IMAGE_NAME=${GUEST_IMAGE_NAME%.*}
214
-    TROVE_GUEST_IMAGE_ID=$(glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-list | grep "${GUEST_IMAGE_NAME}" | get_field 1)
214
+    TROVE_GUEST_IMAGE_ID=$(openstack --os-token $TOKEN --os-url http://$GLANCE_HOSTPORT image list | grep "${GUEST_IMAGE_NAME}" | get_field 1)
215 215
     if [ -z "$TROVE_GUEST_IMAGE_ID" ]; then
216 216
         # If no glance id is found, skip remaining setup
217 217
         echo "Datastore ${TROVE_DATASTORE_TYPE} will not be created: guest image ${GUEST_IMAGE_NAME} not found."