summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorTushar Patil <tushar.vitthal.patil@gmail.com>2011-09-02 22:17:55 +0000
committerTarmac <>2011-09-02 22:17:55 +0000
commit1049a91ef72b09cbff488baec20dc8486d67c475 (patch)
treeafdddbccf6cd44f30db4d7caa943fa700afb51c9 /nova/utils.py
parent3d542086f23b7b432fe776aed1498f9a7a6ebc7d (diff)
parentd3de96998110185d4b67309808cbd9c488597739 (diff)
downloadnova-1049a91ef72b09cbff488baec20dc8486d67c475.tar.gz
nova-1049a91ef72b09cbff488baec20dc8486d67c475.tar.xz
nova-1049a91ef72b09cbff488baec20dc8486d67c475.zip
Added list of security groups to the newly added extension (Createserverext) for the Create Server and Get Server detail responses.
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 21e6221b2..81157a4cd 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -901,3 +901,12 @@ def monkey_patch():
func = import_class("%s.%s" % (module, key))
setattr(sys.modules[module], key,\
decorator("%s.%s" % (module, key), func))
+
+
+def convert_to_list_dict(lst, label):
+ """Convert a value or list into a list of dicts"""
+ if not lst:
+ return None
+ if not isinstance(lst, list):
+ lst = [lst]
+ return [{label: x} for x in lst]