summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
Diffstat (limited to 'vio')
-rw-r--r--vio/vio/swagger/nova_utils.py1
-rw-r--r--vio/vio/swagger/views/volume/views.py6
-rw-r--r--vio/vio/swagger/volume_utils.py6
3 files changed, 11 insertions, 2 deletions
diff --git a/vio/vio/swagger/nova_utils.py b/vio/vio/swagger/nova_utils.py
index ac48ac9..97dc5be 100644
--- a/vio/vio/swagger/nova_utils.py
+++ b/vio/vio/swagger/nova_utils.py
@@ -28,6 +28,7 @@ def server_formatter(server, interfaces=[]):
"contextArray": [],
"userdata": server.user_data,
"nicArray": [],
+ "status": server.status
}
if interfaces:
r['nicArray'] = [{'portId': i.port_id} for i in interfaces]
diff --git a/vio/vio/swagger/views/volume/views.py b/vio/vio/swagger/views/volume/views.py
index 47c6903..73a20e6 100644
--- a/vio/vio/swagger/views/volume/views.py
+++ b/vio/vio/swagger/views/volume/views.py
@@ -114,6 +114,12 @@ class CreateListVolumeView(APIView):
rsp.update(vim_rsp)
return Response(data=rsp, status=status.HTTP_200_OK)
+ if body.get('imageName'):
+ image_op = OperateImage.OperateImage(vim_info)
+ imageName = body.get('imageName')
+ image = image_op.find_vim_image(imageName)
+ body['imageId'] = image.id
+
param = volume_utils.req_body_formatter(body)
volume_info = volume_op.create_vim_volume(**param)
diff --git a/vio/vio/swagger/volume_utils.py b/vio/vio/swagger/volume_utils.py
index 21c2732..44fcbd7 100644
--- a/vio/vio/swagger/volume_utils.py
+++ b/vio/vio/swagger/volume_utils.py
@@ -60,11 +60,13 @@ def sdk_param_formatter(data):
def req_body_formatter(body):
param = {}
+ param['name'] = body.get('name')
param['size'] = body.get('volumeSize')
+
if body.get('volumeType'):
param['volume_type'] = body.get('volumeType')
- param['name'] = body.get('name')
if body.get('availabilityZone'):
param['availability_zone'] = body.get('availabilityZone')
- param['image_id'] = body.get('imageId')
+ if body.get('imageId'):
+ param['image_id'] = body.get('imageId')
return param