Skip to content

Commit bffbdae

Browse files
committed
Adds cinder_show_volume_type.sh
1 parent 75dc6ae commit bffbdae

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cinder_show_volume_type.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
VOLUME_TYPE_ID=$1
5+
6+
TOKENS_RESP=`curl -s -k -X 'POST' $OS_AUTH_URL/tokens -d '{"auth":{"passwordCredentials":{"username": "'$OS_USERNAME'", "password":"'$OS_PASSWORD'"}, "tenantName":"'$OS_TENANT_NAME'"}}' -H 'Content-type: application/json'`
7+
TOKEN=`echo $TOKENS_RESP | python -c "import json; import sys; d=json.load(sys.stdin); print d['access']['token']['id']"`
8+
CINDER_URL=`echo $TOKENS_RESP | python -c "import json; import sys; d=json.load(sys.stdin); print([c for c in d['access']['serviceCatalog'] if c['name'] == 'cinder'][0]['endpoints'][0]['adminURL'])"`
9+
10+
VOLUME_TYPE=`curl -s -H "X-Auth-Token: $TOKEN" $CINDER_URL/types/$VOLUME_TYPE_ID -H 'Content-type: application/json'`
11+
echo $VOLUME_TYPE
12+

0 commit comments

Comments
 (0)