Comment 4 for bug 981269

Revision history for this message
Yaguang Tang (heut2008) wrote :

the essex horizon cann't get the deleted flavor,this because nova api can ony return deleted flavor info by using novaclient.flavors.get() ,novaclient.flavors.list() cann't get the deleted flavor info.

in the essex

     full_flavors = SortedDict([(str(flavor.id), flavor)
                                               for flavor in flavors])
                    for instance in instances:
                        flavor_id = instance.flavor["id"]
                        instance.full_flavor = full_flavors[flavor_id]
                 except:
                    msg = _('Unable to retrieve instance size information.')
                    exceptions.handle(self.request, msg)

folsom

 65
 66 full_flavors = SortedDict([(f.id, f) for f in flavors])
 67 tenant_dict = SortedDict([(t.id, t) for t in tenants])
 68 # Loop through instances to get flavor and tenant info.
 69 for inst in instances:
 70 flavor_id = inst.flavor["id"]
 71 try:
 72 if flavor_id in full_flavors:
 73 inst.full_flavor = full_flavors[flavor_id]
 74 else:
 75 # If the flavor_id is not in full_flavors list,
 76 # gets it via nova api.
 77 inst.full_flavor = api.nova.flavor_get(
 78 self.request, flavor_id)

backport this to stable/horizon