diff options
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio/pub/vim/vimapi/glance/OperateImage.py | 1 | ||||
-rw-r--r-- | vio/vio/swagger/views/flavor/views.py | 7 | ||||
-rw-r--r-- | vio/vio/swagger/views/image/views.py | 2 |
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) |