How to setup image metadata with python API 0.11.0?

asked 2013-08-26 07:18:10 -0500

Skarab gravatar image

updated 2013-08-30 16:24:12 -0500

smaffulli gravatar image

I work with a DevStack-Grizzly installation. I add an image with metadata [see the code]. I use glance.images.create and provide metadata by properties argument. Unfortunately, the created image is without metadata (properties). image.get prints 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',

glance = glanceclient.Client('1',glance_endpoint, token=keystone.auth_token)

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

Is there other way of setting image metadata?

edit retag flag offensive close merge delete