summaryrefslogtreecommitdiff
path: root/horizon/api/nova.py
diff options
context:
space:
mode:
authorGabriel Hurley <gabriel@strikeawe.com>2012-08-12 21:47:18 -0700
committerGabriel Hurley <gabriel@strikeawe.com>2012-08-13 12:07:38 -0700
commita6263af6be01c0918821f2f76dd5c9d47efa77ff (patch)
tree89478679772c82c08731b12a26eecc632b0aaebc /horizon/api/nova.py
parent05cf90049244ea0694d853f9c1e2aff14d753c9a (diff)
downloadtuskar-ui-a6263af6be01c0918821f2f76dd5c9d47efa77ff.tar.gz
Fetch "deleted" flavors for quota tabulation.
Fixes bug 1036031. Change-Id: Iec352c21dec60902ed5521f4858b8b6ee2788485
Diffstat (limited to 'horizon/api/nova.py')
-rw-r--r--horizon/api/nova.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/horizon/api/nova.py b/horizon/api/nova.py
index ef367680..c237595f 100644
--- a/horizon/api/nova.py
+++ b/horizon/api/nova.py
@@ -32,6 +32,7 @@ from novaclient.v1_1 import security_group_rules as nova_rules
from novaclient.v1_1.security_groups import SecurityGroup as NovaSecurityGroup
from novaclient.v1_1.servers import REBOOT_HARD
+from horizon import exceptions
from horizon.api.base import APIResourceWrapper, APIDictWrapper, url_for
from horizon.utils.memoized import memoized
@@ -437,9 +438,18 @@ def tenant_quota_usages(request):
for usage in usages:
for instance in instances:
+ used_flavor = instance.flavor['id']
+ if used_flavor not in flavors:
+ try:
+ flavors[used_flavor] = flavor_get(request, used_flavor)
+ except:
+ flavors[used_flavor] = {}
+ exceptions.handle(request, ignore=True)
for flavor_field in usages[usage]['flavor_fields']:
- usages[usage]['used'] += getattr(
- flavors[instance.flavor['id']], flavor_field, 0)
+ instance_flavor = flavors[used_flavor]
+ usages[usage]['used'] += getattr(instance_flavor,
+ flavor_field,
+ 0)
usages[usage]['quota'] = getattr(quotas, usage)