summaryrefslogtreecommitdiffstats
path: root/share/newton_base/openoapi/server.py
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2018-11-14 08:50:41 +0000
committerHaibin Huang <haibin.huang@intel.com>2018-11-14 09:40:12 +0000
commit1145afaa62e04b8fc31f83f35897d0d121786c00 (patch)
tree0ecf70f607cb32523ec0b83c41e49bc5d652a204 /share/newton_base/openoapi/server.py
parent458989f38849f5a2b2967a73a2160f5876faad71 (diff)
Metadata format is not right
Change-Id: Id658382ecb506c07b619915e3211f736439ad3ec Issue-ID: MULTICLOUD-405 Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Diffstat (limited to 'share/newton_base/openoapi/server.py')
-rw-r--r--share/newton_base/openoapi/server.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/share/newton_base/openoapi/server.py b/share/newton_base/openoapi/server.py
index 57f76196..cdc7e4fa 100644
--- a/share/newton_base/openoapi/server.py
+++ b/share/newton_base/openoapi/server.py
@@ -182,17 +182,17 @@ class Servers(APIView):
logger.info("request returns with status %s" % resp.status_code)
logger.debug("Servers--dettachVolume resp status::>%s" % resp.status_code)
- def _convert_metadata(self, metadata_vfc, metadata_openstack, reverse=True):
- if not reverse:
- # from vfc format to openstack format
- for spec in metadata_vfc:
- metadata_openstack[spec['keyName']] = spec['value']
- else:
- for k, v in metadata_openstack.items():
- spec = {}
- spec['keyName'] = k
- spec['value'] = v
- metadata_vfc.append(spec)
+ #def _convert_metadata(self, metadata_vfc, metadata_openstack, reverse=True):
+ # if not reverse:
+ # # from vfc format to openstack format
+ # for spec in metadata_vfc:
+ # metadata_openstack[spec['keyName']] = spec['value']
+ # else:
+ # for k, v in metadata_openstack.items():
+ # spec = {}
+ # spec['keyName'] = k
+ # spec['value'] = v
+ # metadata_vfc.append(spec)
def _convert_resp(self, server):
#convert volumeArray
@@ -299,11 +299,11 @@ class Servers(APIView):
if not serverid:
# convert the key naming in servers
for server in content["servers"]:
- metadata_openstack = server.pop("metadata", None)
- if metadata_openstack:
- metadata_vfc = []
- self._convert_metadata(metadata_vfc, metadata_openstack, True)
- server["metadata"] = metadata_vfc
+ #metadata_openstack = server.pop("metadata", None)
+ #if metadata_openstack:
+ # metadata_vfc = []
+ # self._convert_metadata(metadata_vfc, metadata_openstack, True)
+ # server["metadata"] = metadata_vfc
VimDriverUtils.replace_key_by_mapping(server,
self.keys_mapping)
self._convert_resp(server)
@@ -312,11 +312,11 @@ class Servers(APIView):
else:
# convert the key naming in the server specified by id
server = content.pop("server", None)
- metadata_openstack = server.pop("metadata", None)
- if metadata_openstack:
- metadata_vfc = []
- self._convert_metadata(metadata_vfc, metadata_openstack, True)
- server["metadata"] = metadata_vfc
+ #metadata_openstack = server.pop("metadata", None)
+ #if metadata_openstack:
+ # metadata_vfc = []
+ # self._convert_metadata(metadata_vfc, metadata_openstack, True)
+ # server["metadata"] = metadata_vfc
VimDriverUtils.replace_key_by_mapping(server,
self.keys_mapping)
self._convert_resp(server)
@@ -378,11 +378,11 @@ class Servers(APIView):
if len(networks) > 0:
server["networks"] = networks
- metadata_vfc = server.pop("metadata", None)
- if metadata_vfc:
- metadata_openstack = {}
- self._convert_metadata(metadata_vfc, metadata_openstack, False)
- server["metadata"] = metadata_openstack
+ #metadata_vfc = server.pop("metadata", None)
+ #if metadata_vfc:
+ # metadata_openstack = {}
+ # self._convert_metadata(metadata_vfc, metadata_openstack, False)
+ # server["metadata"] = metadata_openstack
contextarray = server.pop("contextArray", None)
volumearray = server.pop("volumeArray", None)
@@ -434,11 +434,11 @@ class Servers(APIView):
volumeIds = [extraVolume["volumeId"] for extraVolume in volumearray]
self._attachVolume(vimid, tenantid, resp_body["id"], *volumeIds)
- metadata_openstack = resp_body.pop("metadata", None)
- if metadata_openstack:
- metadata_vfc = []
- self._convert_metadata(metadata_vfc, metadata_openstack, True)
- resp_body["metadata"] = metadata_vfc
+ #metadata_openstack = resp_body.pop("metadata", None)
+ #if metadata_openstack:
+ # metadata_vfc = []
+ # self._convert_metadata(metadata_vfc, metadata_openstack, True)
+ # resp_body["metadata"] = metadata_vfc
VimDriverUtils.replace_key_by_mapping(resp_body, self.keys_mapping)
vim_dict = {