Ask Your Question
0

get a flavors extra-specs in horizon

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

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']
 else:
     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 (https://wiki.openstack.org/wiki/ReleaseNotes/Grizzly#Flavor_Extra_Specs_Support) 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
2

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

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', '-')
u'value'
>>> extras.get('mySpecs', '-')
'-'

Check out the admin flavors panel for other examples.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

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

Seen: 242 times

Last updated: Aug 01 '13