summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2017-03-28 10:54:27 +0800
committerBin Yang <bin.yang@windriver.com>2017-03-28 10:54:27 +0800
commitca20093c544d7ec5ce9e5efe8003576a4ce2e23c (patch)
treec5f364e2a9ce31b3d9c897585272c8d9e92f37d1
parent1dabab968a9350d73a7b3bd98a2a2bbb45081fc8 (diff)
Fix issue of server API
Add name field in response Change-Id: I5b9c9b37b6760962667bd136e1a9b48974048f0d Issue-Id: MULTIVIM-57 Signed-off-by: Bin Yang <bin.yang@windriver.com>
-rw-r--r--kilo/kilo/requests/views/server.py4
-rw-r--r--newton/newton/requests/views/server.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/kilo/kilo/requests/views/server.py b/kilo/kilo/requests/views/server.py
index 75b0a87c..0da19c44 100644
--- a/kilo/kilo/requests/views/server.py
+++ b/kilo/kilo/requests/views/server.py
@@ -135,7 +135,8 @@ class Servers(APIView):
logger.debug("Servers--post::> %s" % request.data)
try:
# check if created already: check name
- query = "name=%s" % request.data["name"]
+ servername = request.data["name"]
+ query = "name=%s" % servername
content, status_code = self.get_servers(query, vimid, tenantid)
existed = False
if status_code == 200:
@@ -235,6 +236,7 @@ class Servers(APIView):
resp_body["volumeArray"] = volumearray
resp_body["nicArray"] = nicarray
resp_body["contextArray"] = contextarray
+ resp_body["name"] = servername
return Response(data=resp_body, status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
diff --git a/newton/newton/requests/views/server.py b/newton/newton/requests/views/server.py
index 51a0efa6..5aec1905 100644
--- a/newton/newton/requests/views/server.py
+++ b/newton/newton/requests/views/server.py
@@ -135,7 +135,8 @@ class Servers(APIView):
logger.debug("Servers--post::> %s" % request.data)
try:
# check if created already: check name
- query = "name=%s" % request.data["name"]
+ servername = request.data["name"]
+ query = "name=%s" % servername
content, status_code = self.get_servers(query, vimid, tenantid)
existed = False
if status_code == 200:
@@ -234,6 +235,7 @@ class Servers(APIView):
resp_body["volumeArray"] = volumearray
resp_body["nicArray"] = nicarray
resp_body["contextArray"] = contextarray
+ resp_body["name"] = servername
return Response(data=resp_body, status=resp.status_code)
except VimDriverNewtonException as e:
return Response(data={'error': e.content}, status=e.status_code)