48 lines
1.7 KiB
Plaintext
48 lines
1.7 KiB
Plaintext
# Copyright 2013 IBM Corp.
|
|
|
|
"""
|
|
Simple Glance client test. This should be more like junits someday. For
|
|
now its just some random tests
|
|
"""
|
|
|
|
from keystoneclient.v3 import client as v3client
|
|
from keystoneclient.v2_0 import client
|
|
from glanceclient.v2 import client as gc
|
|
|
|
keystone_client = client.Client(username='root', password='passw0rd',
|
|
tenant_name='ibm-default', insecure=True,
|
|
auth_url='https://9.5.125.55/powervc/open'
|
|
'stack/identity/v2.0')
|
|
|
|
keystonev3_client = v3client.Client(username='root', password='passw0rd',
|
|
project_name='ibm-default', insecure=True,
|
|
auth_url='https://9.5.125.55/powervc/'
|
|
'openstack/identity/v3')
|
|
|
|
token = keystone_client.auth_token
|
|
tokenv3 = keystonev3_client.auth_token # Keystone v3 test, but not used
|
|
print token
|
|
|
|
glanceUrl = None
|
|
if keystone_client.auth_ref:
|
|
if keystone_client.auth_ref.service_catalog:
|
|
glanceUrl_ret = keystone_client.\
|
|
auth_ref.service_catalog.\
|
|
get_urls(service_type='image', endpoint_type='publicURL')
|
|
if glanceUrl_ret:
|
|
glanceUrl = glanceUrl_ret[0]
|
|
|
|
print glanceUrl
|
|
|
|
glance_client = gc.Client(endpoint=glanceUrl, token=token, insecure=True)
|
|
###print glance_client.images.list()
|
|
|
|
print '=' * 8, 'PowerVC Images using the v2 Glance API', '=' * 8
|
|
v2pvc_images = glance_client.images
|
|
for v2image in v2pvc_images.list():
|
|
print '-' * 40
|
|
print 'Image ', v2image.get('name')
|
|
for v2imagekey in v2image.keys():
|
|
print v2imagekey, '=', v2image.get(v2imagekey)
|
|
print '-' * 40
|