summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorEoghan Glynn <eglynn@redhat.com>2012-07-10 08:16:27 +0100
committerEoghan Glynn <eglynn@redhat.com>2012-07-14 11:00:17 +0100
commita3576bbb0c7090b97b0b02c88ffa81915db6290b (patch)
tree5a1c8b958c8d2723ef48b56ada14adfa9a7be53b /nova/utils.py
parent3f878560229c82d52904f13419259a4e63ab6a05 (diff)
Return 413 status on over-quota in the native API.
Related to LP 1021373. Previously we returned a generic 500 Server Error on an over-quota conditions, whereas this is arguably more appropriately reported as a 413 status. Change-Id: I5c1cdc9db54804c512d60e4179c1faa13516d6f9
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 86cbdce1d..9cfb6d06d 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -1238,6 +1238,19 @@ def sys_platform_translate(arch):
return arch
+def walk_class_hierarchy(clazz, encountered=None):
+ """Walk class hierarchy, yielding most derived classes first"""
+ if not encountered:
+ encountered = []
+ for subclass in clazz.__subclasses__():
+ if subclass not in encountered:
+ encountered.append(subclass)
+ # drill down to leaves first
+ for subsubclass in walk_class_hierarchy(subclass, encountered):
+ yield subsubclass
+ yield subclass
+
+
class UndoManager(object):
"""Provides a mechanism to facilitate rolling back a series of actions
when an exception is raised.