diff -Nru horizon-2012.1.3+stable~20120815-691dd2/debian/changelog horizon-2012.1.3+stable~20120815-691dd2/debian/changelog --- horizon-2012.1.3+stable~20120815-691dd2/debian/changelog 2012-08-31 08:15:13.000000000 +0800 +++ horizon-2012.1.3+stable~20120815-691dd2/debian/changelog 2013-01-11 20:18:34.000000000 +0800 @@ -1,3 +1,10 @@ +horizon (2012.1.3+stable~20120815-691dd2-0ubuntu1.2) precise; urgency=low + + * Fix deleted flavors which are used cann't be retrived and cause exception + issue (LP: #981269) + + -- Yaguang Tang (Yaguang) Fri, 11 Jan 2013 20:15:21 +0800 + horizon (2012.1.3+stable~20120815-691dd2-0ubuntu1.1) precise-security; urgency=low * SECURITY UPDATE: open redirect / phishing attack via "next" diff -Nru horizon-2012.1.3+stable~20120815-691dd2/debian/patches/deleted-flavor-exception.patch horizon-2012.1.3+stable~20120815-691dd2/debian/patches/deleted-flavor-exception.patch --- horizon-2012.1.3+stable~20120815-691dd2/debian/patches/deleted-flavor-exception.patch 1970-01-01 08:00:00.000000000 +0800 +++ horizon-2012.1.3+stable~20120815-691dd2/debian/patches/deleted-flavor-exception.patch 2013-01-11 20:20:17.000000000 +0800 @@ -0,0 +1,77 @@ +Description: Fix the issue that deleted flavor which is inuse cause exception. + Nova flavor-delete allows deletion of a given flavor, when there are running +instances with this flavor. That causes horizon and other tools not to work +properly and throw errors for the running instances which flavor has been deleted. + +Author: Yaguang Tang (Yaguang) +Bug-Ubuntu: https://bugs.launchpad.net/bugs/981269 + +--- horizon-2012.1.3+stable~20120815-691dd2.orig/horizon/dashboards/nova/instances_and_volumes/views.py ++++ horizon-2012.1.3+stable~20120815-691dd2/horizon/dashboards/nova/instances_and_volumes/views.py +@@ -54,13 +54,27 @@ class IndexView(tables.MultiTableView): + if instances: + try: + flavors = api.flavor_list(self.request) +- full_flavors = SortedDict([(str(flavor.id), flavor) for \ +- flavor in flavors]) +- for instance in instances: +- instance.full_flavor = full_flavors[instance.flavor["id"]] + except: +- msg = _('Unable to retrieve instance size information.') +- exceptions.handle(self.request, msg) ++ # If fails to retrieve flavor list, creates an empty list. ++ flavors = [] ++ ++ full_flavors = SortedDict([(str(flavor.id), flavor) ++ for flavor in flavors]) ++ for instance in instances: ++ try: ++ flavor_id = instance.flavor["id"] ++ if flavor_id in full_flavors: ++ instance.full_flavor = full_flavors[flavor_id] ++ else: ++ # If the flavor_id is not in full_flavors list, ++ # gets it via nova api. ++ instance.full_flavor = api.flavor_get( ++ self.request, flavor_id) ++ ++ except: ++ msg = _('Unable to retrieve instance size \ ++ information.') ++ exceptions.handle(self.request, msg) + return instances + + def get_volumes_data(self): +--- horizon-2012.1.3+stable~20120815-691dd2.orig/horizon/dashboards/syspanel/instances/views.py ++++ horizon-2012.1.3+stable~20120815-691dd2/horizon/dashboards/syspanel/instances/views.py +@@ -52,8 +52,6 @@ class AdminIndexView(tables.DataTableVie + flavors = api.nova.flavor_list(self.request) + except: + flavors = [] +- msg = _('Unable to retrieve instance size information.') +- exceptions.handle(self.request, msg) + # Gather our tenants to correlate against IDs + try: + tenants = api.keystone.tenant_list(self.request, admin=True) +@@ -64,8 +62,18 @@ class AdminIndexView(tables.DataTableVie + + full_flavors = SortedDict([(f.id, f) for f in flavors]) + tenant_dict = SortedDict([(t.id, t) for t in tenants]) ++ # Loop through instances to get flavor and tenant info. + for inst in instances: +- inst.full_flavor = full_flavors.get(inst.flavor["id"], None) +- tenant = tenant_dict.get(inst.tenant_id, None) +- inst.tenant_name = getattr(tenant, "name", None) ++ flavor_id = inst.flavor["id"] ++ try: ++ if flavor_id in full_flavors: ++ inst.full_flavor = full_flavors[flavor_id] ++ else: ++ # If the flavor_id is not in full_flavors list, ++ # flavor may be a 'deleted', gets it via nova api. ++ inst.full_flavor = api.nova.flavor_get( ++ self.request, flavor_id) ++ except: ++ msg = _('Unable to retrieve instance size information.') ++ exceptions.handle(self.request, msg) + return instances diff -Nru horizon-2012.1.3+stable~20120815-691dd2/debian/patches/series horizon-2012.1.3+stable~20120815-691dd2/debian/patches/series --- horizon-2012.1.3+stable~20120815-691dd2/debian/patches/series 2012-08-31 08:14:53.000000000 +0800 +++ horizon-2012.1.3+stable~20120815-691dd2/debian/patches/series 2013-01-11 20:19:31.000000000 +0800 @@ -7,3 +7,4 @@ use-memcache.patch juju_panel-handle_catalog_exception.patch CVE-2012-3540.patch +deleted-flavor-exception.patch