Enhance SDN assist error reporting 33/6333/6
authortierno <alfonso.tiernosepulveda@telefonica.com>
Fri, 13 Jul 2018 13:25:24 +0000 (15:25 +0200)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Thu, 19 Jul 2018 12:53:26 +0000 (14:53 +0200)
Change-Id: I1160b17eb053af427e6aede9f4f95013afc9e633
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
openmanod
osm_ro/openmano_schemas.py
osm_ro/vim_thread.py
osm_ro/vimconn_openvim.py

index 05747d7..f3b2800 100755 (executable)
--- a/openmanod
+++ b/openmanod
@@ -48,7 +48,7 @@ import osm_ro
 
 __author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes"
 __date__ = "$26-aug-2014 11:09:29$"
-__version__ = "0.5.72-r582"
+__version__ = "0.5.73-r583"
 version_date = "Jul 2018"
 database_version = 32      # expected database schema version
 
index fe59572..6c0dbdc 100644 (file)
@@ -1077,9 +1077,6 @@ instance_scenario_create_schema_v01 = {
                                         }
                                     }
                                 },
-                                
-
-
                             }
                         }
                     },
index 0f8dec7..e82e37e 100644 (file)
@@ -277,7 +277,7 @@ class vim_thread(threading.Thread):
                             if task_interface.get("sdn_port_id"):
                                 try:
                                     with self.db_lock:
-                                        self.ovim.delete_port(task_interface["sdn_port_id"])
+                                        self.ovim.delete_port(task_interface["sdn_port_id"], idempotent=True)
                                         task_interface["sdn_port_id"] = None
                                         task_need_update = True
                                 except ovimException as e:
@@ -394,18 +394,18 @@ class vim_thread(threading.Thread):
                         except (ovimException, Exception) as e:
                             text_error = "ovimException getting network snd_net_id={}: {}".format(task_sdn_net_id, e)
                             self.logger.error("task={} get-net: {}".format(task_id, text_error), exc_info=True)
-                            sdn_net = {"status": "ERROR", "error_msg": text_error}
+                            sdn_net = {"status": "ERROR", "last_error": text_error}
                         if sdn_net["status"] == "ERROR":
                             if not vim_info_error_msg:
-                                vim_info_error_msg = sdn_net["error_msg"]
+                                vim_info_error_msg = str(sdn_net.get("last_error"))
                             else:
                                 vim_info_error_msg = "VIM_ERROR: {} && SDN_ERROR: {}".format(
                                     self._format_vim_error_msg(vim_info_error_msg, 1024//2-14),
-                                    self._format_vim_error_msg(sdn_net["error_msg"], 1024//2-14))
-                            if vim_info_status == "VIM_ERROR":
-                                vim_info_status = "VIM_SDN_ERROR"
-                            else:
-                                vim_info_status = "SDN_ERROR"
+                                    self._format_vim_error_msg(sdn_net["last_error"], 1024//2-14))
+                            vim_info_status = "ERROR"
+                        elif sdn_net["status"] == "BUILD":
+                            if vim_info_status == "ACTIVE":
+                                vim_info_status = "BUILD"
 
                     # update database
                     if vim_info_error_msg:
@@ -859,7 +859,7 @@ class vim_thread(threading.Thread):
                 if iface.get("sdn_port_id"):
                     try:
                         with self.db_lock:
-                            self.ovim.delete_port(iface["sdn_port_id"])
+                            self.ovim.delete_port(iface["sdn_port_id"], idempotent=True)
                     except ovimException as e:
                         self.logger.error("task={} del-VM: ovimException when deleting external_port={}: {} ".format(
                             task_id, iface["sdn_port_id"], e), exc_info=True)
@@ -996,8 +996,8 @@ class vim_thread(threading.Thread):
                     port_list = self.ovim.get_ports(columns={'uuid'},
                                                     filter={'name': 'external_port', 'net_id': sdn_net_id})
                     for port in port_list:
-                        self.ovim.delete_port(port['uuid'])
-                    self.ovim.delete_network(sdn_net_id)
+                        self.ovim.delete_port(port['uuid'], idempotent=True)
+                    self.ovim.delete_network(sdn_net_id, idempotent=True)
             if net_vim_id:
                 self.vim.delete_network(net_vim_id)
             task["status"] = "DONE"
index 417092f..5e5349d 100644 (file)
@@ -600,6 +600,8 @@ class vimconnector(vimconn.vimconnector):
             for device in new_flavor_dict.get('extended', {}).get('devices', ()):
                 if 'image name' in device:
                     del device['image name']
+                if 'name' in device:
+                    del device['name']
             numas = new_flavor_dict.get('extended', {}).get('numas')
             if numas:
                 numa = numas[0]