0

I can list and create flavor using this code:

flavors_list = nova_client.flavors.list()
print_flavors(flavors_list)

print(nova_client.servers.list())
nova_client.flavors.create(name = 'test2', ram = 512, vcpus = 1, 
                       disk = 1000, 
                       flavorid='auto', ephemeral=0, swap=0, 
                       rxtx_factor=1.0, is_public=True)

But I can find method for update metadata flavor.

Anybody know which method updates metadata flavor?

CroMagnon
  • 1,218
  • 7
  • 20
  • 32
xuananh
  • 3
  • 2

1 Answers1

0

There is the method "set_keys(metadata)" in novaclient.v2.flavors.Flavor class.

I think you can use it to update metadata

new_flavor = nova_client.flavors.create(name='test2',
                                        ram=512,
                                        vcpus=1,
                                        disk=1000,
                                        flavorid='auto',
                                        ephemeral=0,
                                        swap=0,
                                        rxtx_factor=1.0,
                                        is_public=True)
new_flavor.set_keys(metadata)

where metadata is a dict of key/value pairs to be set.

p.s. The method "create( )" will return the Flavor object.

reference : http://docs.openstack.org/developer/python-novaclient/ref/v2/flavors.html

Curtis Su
  • 50
  • 4