summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
authorxinhuili <lxinhui@vmware.com>2017-03-29 07:03:05 -0700
committerxinhuili <lxinhui@vmware.com>2017-03-29 07:03:05 -0700
commit3c29a80e90dbe9e9763a2eda0db108ec21ef38c7 (patch)
tree3edfd6efbb8e8b44dc627201163fa8622e79a540 /vio
parentc33d3b52529ea80b4f8b8c5f3774beadfbbb68de (diff)
Fix create image issue
This patch is to fix create image pending. Change-Id: I03fbf6d46e020fe55da55885110619bfa7f026b1 Issue-ids: MULTIVIM-36 Signed-off-by: xinhuili <lxinhui@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r--vio/vio/pub/vim/vimapi/glance/OperateImage.py1
-rw-r--r--vio/vio/swagger/views/flavor/views.py7
-rw-r--r--vio/vio/swagger/views/image/views.py2
3 files changed, 3 insertions, 7 deletions
diff --git a/vio/vio/pub/vim/vimapi/glance/OperateImage.py b/vio/vio/pub/vim/vimapi/glance/OperateImage.py
index 2b08359..ce9ae75 100644
--- a/vio/vio/pub/vim/vimapi/glance/OperateImage.py
+++ b/vio/vio/pub/vim/vimapi/glance/OperateImage.py
@@ -50,6 +50,7 @@ class imageThread(threading.Thread):
logger.debug("Image----transfer_image")
vim_info = extsys.get_vim_by_id(vimid)
+ vim_info['tenant'] = tenantid
param = image_utils.sdk_param_formatter(vim_info)
data = imagefd.read()
diff --git a/vio/vio/swagger/views/flavor/views.py b/vio/vio/swagger/views/flavor/views.py
index c774f90..b6bc437 100644
--- a/vio/vio/swagger/views/flavor/views.py
+++ b/vio/vio/swagger/views/flavor/views.py
@@ -45,7 +45,6 @@ class FlavorsView(APIView):
flavor_name = create_req.get('name', None)
flavor_id = create_req.get('id', None)
flavors_op = OperateFlavors.OperateFlavors()
- exist = False
try:
target = flavor_id or flavor_name
flavor = flavors_op.find_flavor(data, tenantid, target)
@@ -53,7 +52,6 @@ class FlavorsView(APIView):
flavor, extra_specs = flavors_op.get_flavor(
data, tenantid, flavor.id)
rsp['returnCode'] = 0
- exist = True
else:
rsp['returnCode'] = 1
flavor, extra_specs = flavors_op.create_flavor(
@@ -66,10 +64,7 @@ class FlavorsView(APIView):
return Response(data={'error': str(e)},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
rsp.update(flavor_dict)
- if exist:
- return Response(data=rsp, status=status.HTTP_200_OK)
- else:
- return Response(data=rsp, status=status.HTTP_202_ACCEPTED)
+ return Response(data=rsp, status=status.HTTP_200_OK)
def get(self, request, vimid, tenantid):
try:
diff --git a/vio/vio/swagger/views/image/views.py b/vio/vio/swagger/views/image/views.py
index 43ed3c5..edc3873 100644
--- a/vio/vio/swagger/views/image/views.py
+++ b/vio/vio/swagger/views/image/views.py
@@ -125,7 +125,7 @@ class CreateListImagesView(APIView):
rsp = image_utils.image_formatter(image)
rsp.update(vim_rsp)
rsp['returnCode'] = '1'
- return Response(data=rsp, status=status.HTTP_201_ACCEPTED)
+ return Response(data=rsp, status=status.HTTP_201_CREATED)
except Exception as e:
if hasattr(e, "http_status"):
return Response(data={'error': str(e)}, status=e.http_status)