summaryrefslogtreecommitdiffstats
path: root/share/newton_base
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2018-11-14 08:50:41 +0000
committerHuang Haibin <haibin.huang@intel.com>2018-11-27 10:43:03 +0000
commit2210a55a7107937116c20f3b1175944083df9635 (patch)
tree760b3d23ef122a2888110e5e4fa944cae126844d /share/newton_base
parent69c7fffdcc22bc47a84775a7214b0495efa04baf (diff)
Metadata format is not right
Change-Id: Id658382ecb506c07b619915e3211f736439ad3ec Issue-ID: MULTICLOUD-405 Signed-off-by: Haibin Huang <haibin.huang@intel.com> (cherry picked from commit 1145afaa62e04b8fc31f83f35897d0d121786c00)
Diffstat (limited to 'share/newton_base')
-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 = {