[Openstack] Nova-Glance Query

Brian Rosmaita brian.rosmaita at RACKSPACE.COM
Wed Sep 28 14:22:26 UTC 2016


Amit,

For Glance, all the user-specified image metadata must be String data type.

You can see this in the image schema [0], where "additionalProperties": {"type": "string"}

(The only image properties that are *not* strings are those assigned non-string types in the schema.)

So for your example, you need:
    metadata = {'hw_numa_nodes': '2'}

It's a little counterintuitive, but the idea is that Glance has know way of knowing what kind of metadata you'll want to put on an image, so Glance stores everything as a string.  Since it's your metadata, you'll know what data type to convert the string to before you use it in a script.

Hope that helps!

[0] http://developer.openstack.org/api-ref/image/v2/?expanded=show-image-schema-detail

On 9/28/16, 2:45 AM, "Amit Uniyal" <auniyal61 at gmail.com<mailto:auniyal61 at gmail.com>> wrote:

Hi,

I am using python-openstackclient and os_client_config

My requirement is, i want to update, my image metadata ....

i made two objects, by which i think i may achieve it:

nova = os_client_config.make_client('compute')
glance = os_client_config.make_client('images')

example: metadata = {'hw_numa_nodes': 2,}


i tried it many things, but not get succeed,  like:

n_im = nova.images.get(<image_id>)

nova.images.set_meta(n_im, metadata), or
n_im.manager.set_meta(n_im, metadata)


 ........ and many other also ..

please suggest what would be the proper way to do it,

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20160928/7b0ad88e/attachment.html>


More information about the Openstack mailing list