summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxinhuili <lxinhui@vmware.com>2017-04-04 23:21:22 -0700
committerxinhuili <lxinhui@vmware.com>2017-04-04 23:21:22 -0700
commite7c63633e1eec4f99ef13b70f86a8bda8537361e (patch)
tree5bd500feebe9e1d2e75907b009ea1afc254094f4
parent7718ce45bc14def8528a1c8c24dab07ddf1fb39a (diff)
Merge several fixesv2.0.0release/mercury
This patch is to merge several fixes. Change-Id: I71575bbc5d82aa6544293985d3740ea10751f652 Issue-ids: MULTIVIM-36 Signed-off-by: xinhuili <lxinhui@vmware.com>
-rw-r--r--vio/vio/pub/vim/drivers/vimsdk/cinder_v2.py1
-rw-r--r--vio/vio/pub/vim/drivers/vimsdk/sdk.py6
-rw-r--r--vio/vio/pub/vim/vimapi/network/OperateNetwork.py4
-rw-r--r--vio/vio/pub/vim/vimapi/network/OperatePort.py6
-rw-r--r--vio/vio/pub/vim/vimapi/nova/OperateFlavors.py2
-rw-r--r--vio/vio/swagger/views/hypervisor/views.py3
6 files changed, 16 insertions, 6 deletions
diff --git a/vio/vio/pub/vim/drivers/vimsdk/cinder_v2.py b/vio/vio/pub/vim/drivers/vimsdk/cinder_v2.py
index c0c2db1..3776aca 100644
--- a/vio/vio/pub/vim/drivers/vimsdk/cinder_v2.py
+++ b/vio/vio/pub/vim/drivers/vimsdk/cinder_v2.py
@@ -22,7 +22,6 @@ class CinderClient(base.DriverBase):
def __init__(self, params):
super(CinderClient, self).__init__(params)
- LOG.info("%s", str(params))
self.conn = sdk.create_connection(params)
self.session = self.conn.session
diff --git a/vio/vio/pub/vim/drivers/vimsdk/sdk.py b/vio/vio/pub/vim/drivers/vimsdk/sdk.py
index 228ead8..25ba3bb 100644
--- a/vio/vio/pub/vim/drivers/vimsdk/sdk.py
+++ b/vio/vio/pub/vim/drivers/vimsdk/sdk.py
@@ -33,6 +33,10 @@ def parse_exception(ex):
'''Parse exception code and yield useful information.'''
code = 500
+ # print ex for debug
+ import traceback
+ traceback.print_exc()
+
if isinstance(ex, sdk_exc.HttpException):
# some exceptions don't contain status_code
if ex.http_status is not None:
@@ -77,8 +81,6 @@ def parse_exception(ex):
# This could be a generic exception or something we don't understand
message = six.text_type(ex)
- import traceback
- traceback.print_exc()
raise ex
# raise senlin_exc.InternalError(code=code, message=message)
diff --git a/vio/vio/pub/vim/vimapi/network/OperateNetwork.py b/vio/vio/pub/vim/vimapi/network/OperateNetwork.py
index 7090f81..03083cf 100644
--- a/vio/vio/pub/vim/vimapi/network/OperateNetwork.py
+++ b/vio/vio/pub/vim/vimapi/network/OperateNetwork.py
@@ -25,7 +25,9 @@ def translate(mapping, data, revert=True):
if revert:
for key in mapping:
if key in data:
- data[mapping[key]] = data.pop(key)
+ val = data.pop(key)
+ if val != '':
+ data[mapping[key]] = val
else:
for key in mapping:
if mapping[key] in data:
diff --git a/vio/vio/pub/vim/vimapi/network/OperatePort.py b/vio/vio/pub/vim/vimapi/network/OperatePort.py
index 8f89ffc..f15ad73 100644
--- a/vio/vio/pub/vim/vimapi/network/OperatePort.py
+++ b/vio/vio/pub/vim/vimapi/network/OperatePort.py
@@ -51,6 +51,12 @@ class OperatePort(BaseNet):
vim_info = self.get_vim_info(vimid)
network = self.auth(vim_info, tenantid)
body = translate(self.keys_mapping, body)
+ if 'network_id' in body:
+ net = network.network_get(body['network_id'])
+ body['network_id'] = net.id
+ if 'subnetId' in body:
+ subnet = network.subnet_get(body['subnetId'])
+ body['subnetId'] = subnet.id
if "ip" in body:
body['fixed_ips'] = [{'subnet_id': body.pop('subnetId'),
"ip_address": body.pop('ip')}]
diff --git a/vio/vio/pub/vim/vimapi/nova/OperateFlavors.py b/vio/vio/pub/vim/vimapi/nova/OperateFlavors.py
index 569e333..a1fb897 100644
--- a/vio/vio/pub/vim/vimapi/nova/OperateFlavors.py
+++ b/vio/vio/pub/vim/vimapi/nova/OperateFlavors.py
@@ -29,7 +29,7 @@ class OperateFlavors(OperateNova):
"name": create_req.get('name'),
"vcpus": create_req.get('vcpu'),
"ram": create_req.get('memory'),
- "disk": create_req.get('disk'),
+ "disk": create_req.get('disk', 0),
"ephemeral": create_req.get('ephemeral', 0),
"swap": create_req.get('swap', 0),
"is_public": create_req.get('isPublic', True)
diff --git a/vio/vio/swagger/views/hypervisor/views.py b/vio/vio/swagger/views/hypervisor/views.py
index 2b96524..b6b41ea 100644
--- a/vio/vio/swagger/views/hypervisor/views.py
+++ b/vio/vio/swagger/views/hypervisor/views.py
@@ -39,7 +39,8 @@ class HostView(APIView):
'url': vim_info['url'],
'project_id': tenantid,
'user_domain_name': 'default',
- 'project_domain_name': 'default'}
+ 'project_domain_name': 'default'
+ }
hypervisor_op = OperateHypervisor.OperateHypervisor()
try: