summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vio/vio/pub/vim/vimapi/nova/OperateServers.py7
-rw-r--r--vio/vio/swagger/nova_utils.py7
2 files changed, 9 insertions, 5 deletions
diff --git a/vio/vio/pub/vim/vimapi/nova/OperateServers.py b/vio/vio/pub/vim/vimapi/nova/OperateServers.py
index b14c7f4..289fbc9 100644
--- a/vio/vio/pub/vim/vimapi/nova/OperateServers.py
+++ b/vio/vio/pub/vim/vimapi/nova/OperateServers.py
@@ -59,9 +59,12 @@ class OperateServers(OperateNova):
az = create_req.get('availabilityZone', None)
if az:
req['availability_zone'] = az
- md = create_req.get('metadata', [])
+ # md = create_req.get('metadata', [])
+ # if md:
+ # req['metadata'] = {n['keyName']: n['value'] for n in md}
+ md = create_req.get('metadata', {})
if md:
- req['metadata'] = {n['keyName']: n['value'] for n in md}
+ req['metadata'] = md
userdata = create_req.get('userdata', None)
if userdata:
req['user_data'] = base64.encodestring(userdata)
diff --git a/vio/vio/swagger/nova_utils.py b/vio/vio/swagger/nova_utils.py
index cf9c970..ebed57d 100644
--- a/vio/vio/swagger/nova_utils.py
+++ b/vio/vio/swagger/nova_utils.py
@@ -21,7 +21,7 @@ def server_formatter(server, interfaces=[]):
"availabilityZone": server.availability_zone,
"flavorId": server.flavor_id or server.flavor['id'],
"volumeArray": [],
- "metadata": [],
+ "metadata": {},
"securityGroups": [],
# TODO finish following attributes
"serverGroup": "",
@@ -55,8 +55,9 @@ def server_formatter(server, interfaces=[]):
'volumeId': r['volumeArray'][0]['volumeId']
}
if server.metadata:
- r["metadata"] = [{'keyName': k, 'value': v}
- for k, v in six.iteritems(server.metadata)]
+ # r["metadata"] = [{'keyName': k, 'value': v}
+ # for k, v in six.iteritems(server.metadata)]
+ r["metadata"] = server.metadata
if server.security_groups:
r["securityGroups"] = [i['name'] for i in server.security_groups]
return r