From cf22714dc4fc0905a8b0998e43bb580c1899b7ac Mon Sep 17 00:00:00 2001 From: montesmoreno Date: Thu, 12 Jan 2017 12:24:21 +0000 Subject: [PATCH] Added support for regions. Solved bug in server creation rollback. Signed-off-by: montesmoreno --- nfvo.py | 1 - vimconn_openstack.py | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/nfvo.py b/nfvo.py index e64ba1c9..f75c9880 100644 --- a/nfvo.py +++ b/nfvo.py @@ -2005,7 +2005,6 @@ def create_instance(mydb, tenant_id, instance_dict): netDict['vpci'] = iface['vpci'] if "mac" in iface and iface["mac"] is not None: netDict['mac_address'] = iface['mac'] - logger.debug("Pablo iface %s", str(iface)) if "port-security" in iface and iface["port-security"] is not None: netDict['port_security'] = iface['port-security'] if "floating-ip" in iface and iface["floating-ip"] is not None: diff --git a/vimconn_openstack.py b/vimconn_openstack.py index c5b4ce1f..83ad940d 100644 --- a/vimconn_openstack.py +++ b/vimconn_openstack.py @@ -96,6 +96,9 @@ class vimconnector(vimconn.vimconnector): if self.osc_api_version == 'v3.3': self.k_creds['project_name'] = tenant_name self.k_creds['project_id'] = tenant_id + if config.get('region_name'): + self.k_creds['region_name'] = config.get('region_name') + self.n_creds['region_name'] = config.get('region_name') self.reload_client = True self.logger = logging.getLogger('openmano.vim.openstack') @@ -706,7 +709,7 @@ class vimconnector(vimconn.vimconnector): port_dict["name"]=name if net.get("mac_address"): port_dict["mac_address"]=net["mac_address"] - if "port_security" in net: + if net.get("port_security") == False: port_dict["port_security_enabled"]=net["port_security"] new_port = self.neutron.create_port({"port": port_dict }) net["mac_adress"] = new_port["port"]["mac_address"] @@ -790,7 +793,7 @@ class vimconnector(vimconn.vimconnector): #delete ports we just created for net_item in net_list_vim: if 'port-id' in net_item: - self.neutron.delete_port(net_item['port_id']) + self.neutron.delete_port(net_item['port-id']) raise vimconn.vimconnException('Timeout creating volumes for instance ' + name, http_code=vimconn.HTTP_Request_Timeout) @@ -803,7 +806,6 @@ class vimconnector(vimconn.vimconnector): block_device_mapping = block_device_mapping ) # , description=description) #print "DONE :-)", server - pool_id = None floating_ips = self.neutron.list_floatingips().get("floatingips", ()) for floating_network in external_network: @@ -880,7 +882,7 @@ class vimconnector(vimconn.vimconnector): # delete ports we just created for net_item in net_list_vim: if 'port-id' in net_item: - self.neutron.delete_port(net_item['port_id']) + self.neutron.delete_port(net_item['port-id']) self._format_exception(e) except TypeError as e: raise vimconn.vimconnException(type(e).__name__ + ": "+ str(e), http_code=vimconn.HTTP_Bad_Request) -- 2.25.1