From: tierno Date: Wed, 20 Jun 2018 08:44:32 +0000 (+0200) Subject: Fix error at some openstacks getting floating ip for neutron port X-Git-Tag: BUILD_v4.0.1_1~10 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=b42fd9bdcea865bd3c6d4a546a6f294ff69e1ef4;p=osm%2FRO.git Fix error at some openstacks getting floating ip for neutron port Change-Id: I7b0706098db372e80c310ff7f8a545755d1fbdc4 --- diff --git a/openmanod b/openmanod index b2a4b6d4..4f308883 100755 --- a/openmanod +++ b/openmanod @@ -48,8 +48,8 @@ import osm_ro __author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes" __date__ = "$26-aug-2014 11:09:29$" -__version__ = "0.5.67-r577" -version_date = "May 2018" +__version__ = "0.5.68-r578" +version_date = "Jun 2018" database_version = 31 # expected database schema version diff --git a/osm_ro/vimconn_openstack.py b/osm_ro/vimconn_openstack.py index 35aed88c..43fdbc51 100644 --- a/osm_ro/vimconn_openstack.py +++ b/osm_ro/vimconn_openstack.py @@ -1401,7 +1401,7 @@ class vimconnector(vimconn.vimconnector): #get interfaces try: self._reload_connection() - port_dict=self.neutron.list_ports(device_id=vm_id) + port_dict = self.neutron.list_ports(device_id=vm_id) for port in port_dict["ports"]: interface={} try: @@ -1435,16 +1435,20 @@ class vimconnector(vimconn.vimconnector): interface["vlan"] = network['network'].get('provider:segmentation_id') ips=[] #look for floating ip address - floating_ip_dict = self.neutron.list_floatingips(port_id=port["id"]) - if floating_ip_dict.get("floatingips"): - ips.append(floating_ip_dict["floatingips"][0].get("floating_ip_address") ) + try: + floating_ip_dict = self.neutron.list_floatingips(port_id=port["id"]) + if floating_ip_dict.get("floatingips"): + ips.append(floating_ip_dict["floatingips"][0].get("floating_ip_address") ) + except Exception: + pass for subnet in port["fixed_ips"]: ips.append(subnet["ip_address"]) interface["ip_address"] = ";".join(ips) vm["interfaces"].append(interface) except Exception as e: - self.logger.error("Error getting vm interface information " + type(e).__name__ + ": "+ str(e)) + self.logger.error("Error getting vm interface information {}: {}".format(type(e).__name__, e), + exc_info=True) except vimconn.vimconnNotFoundException as e: self.logger.error("Exception getting vm status: %s", str(e)) vm['status'] = "DELETED"