From a3576bbb0c7090b97b0b02c88ffa81915db6290b Mon Sep 17 00:00:00 2001 From: Eoghan Glynn Date: Tue, 10 Jul 2012 08:16:27 +0100 Subject: 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 --- nova/utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'nova/utils.py') 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. -- cgit