Ask Your Question

get a flavors extra-specs in horizon

asked 2013-08-01 18:18:54 -0600

stdalex gravatar image

Hi all,

i'm trying to port some UI customization I did in Folsom so that it works in Grizzly and I could use everyones help. Must of the process has gone smoothly, there is just one piece that isn't working. Its the code that gets the extra-specs of a flavor while in horizon. My old folsom based code looks like this:

 flavor = api.flavor_get(self.request, flavor_id)
 extras = flavor.get_keys()
 inst.flavor_id = flavor_id
 if extras:
     inst.myvalue = extras['mySpecs']
     inst.myvalue = "-"

But using that code in Grizzly causes a crash ( and no log entries so i don't even know why). I did some research and saw in the release notes of Grizzly that they had added support for getting a flavors extra specs in horizon ( but I can't find any actual examples of how to do it.

Thanks all

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-08-01 22:15:06 -0600

kspear gravatar image

You can use the flavor_get_extras() function:

>>> extras = api.nova.flavor_get_extras(self.request, flavor_id, raw=True)
>>> extras
{u'test': u'value'}
>>> extras.get('test', '-')
>>> extras.get('mySpecs', '-')

Check out the admin flavors panel for other examples.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2013-08-01 18:18:54 -0600

Seen: 320 times

Last updated: Aug 01 '13