我使用DevStack -Grizzly 安装。我使用Openstack python API添加带有元数据的图像 [参见代码] 。
我使用 glance.images.create并通过属性参数提供元数据。不幸的是,创建的图像没有元数据(属性)。image.get打印NONE。
import keystoneclient.v2_0.client as ksclient
import glanceclient
keystone = ksclient.Client(auth_url=credentials['auth-url'], username=credentials['username'],
password=credentials['password'], tenant_name=credentials['tenant'])
glance_endpoint = keystone.service_catalog.url_for(service_type='image',
endpoint_type='publicURL')
glance = glanceclient.Client('1',glance_endpoint, token=keystone.auth_token)
image_name="test-cirros"
image_file="cirros.img"
with open( image_file ) as fimage:
image = glance.images.create(name=image_name, is_public=True, disk_format="qcow2", container_format="bare", data=fimage, properties = {"aaaa": "13", "'bbbbbb": "12"} )
print image.get() // prints NONE
还有其他设置图像元数据的方法吗?