From ad6bdd4a680031211535bd2e5da7ada14ca28e91 Mon Sep 17 00:00:00 2001 From: tierno Date: Wed, 10 Jan 2018 10:43:46 +0100 Subject: [PATCH] Fixed volume deletion error at openstack Change-Id: Icff2b4da07613fe69b8b1bbead45a01fd71fccc9 Signed-off-by: tierno --- openmanod | 9 +++++---- osm_ro/nfvo.py | 4 ++-- osm_ro/vimconn_openstack.py | 13 +++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/openmanod b/openmanod index 51b67f3d..b9858b47 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.46-r556" -version_date = "Dec 2017" +__version__ = "0.5.47-r557" +version_date = "Jan 2018" database_version = 27 # expected database schema version @@ -60,9 +60,10 @@ global logger class LoadConfigurationException(Exception): pass + def load_configuration(configuration_file): - default_tokens = {'http_port':9090, - 'http_host':'localhost', + default_tokens = {'http_port': 9090, + 'http_host': 'localhost', 'http_console_proxy': True, 'http_console_host': None, 'log_level': 'DEBUG', diff --git a/osm_ro/nfvo.py b/osm_ro/nfvo.py index 3b1e4c0c..a6d3ba3e 100644 --- a/osm_ro/nfvo.py +++ b/osm_ro/nfvo.py @@ -392,7 +392,7 @@ def rollback(mydb, vims, rollback_list): mydb.delete_row(FROM="datacenters_images", WHERE={"datacenter_vim_id": vim["id"], "vim_id":item["uuid"]}) elif item["what"]=="flavor": vim.delete_flavor(item["uuid"]) - mydb.delete_row(FROM="datacenters_flavors", WHERE={"datacenter_id": vim["id"], "vim_id":item["uuid"]}) + mydb.delete_row(FROM="datacenters_flavors", WHERE={"datacenter_vim_id": vim["id"], "vim_id":item["uuid"]}) elif item["what"]=="network": vim.delete_network(item["uuid"]) elif item["what"]=="vm": @@ -828,7 +828,7 @@ def new_vnfd_v3(mydb, tenant_id, vnf_descriptor): try: myvnfd = vnfd_catalog.vnfd() try: - pybindJSONDecoder.load_ietf_json(vnf_descriptor, None, None, obj=myvnfd) + pybindJSONDecoder.load_ietf_json(vnf_descriptor, None, None, obj=myvnfd, path_helper=True) except Exception as e: raise NfvoException("Error. Invalid VNF descriptor format " + str(e), HTTP_Bad_Request) db_vnfs = [] diff --git a/osm_ro/vimconn_openstack.py b/osm_ro/vimconn_openstack.py index 3fd9f562..85b8dc84 100644 --- a/osm_ro/vimconn_openstack.py +++ b/osm_ro/vimconn_openstack.py @@ -1283,8 +1283,9 @@ class vimconnector(vimconn.vimconnector): if not v: # skip already deleted continue try: - if k.startswith("port:"): - self.neutron.delete_port(k.strip("port:")) + k_item, _, k_id = k.partition(":") + if k_item == "port": + self.neutron.delete_port(k_id) except Exception as e: self.logger.error("Error deleting port: {}: {}".format(type(e).__name__, e)) @@ -1308,12 +1309,12 @@ class vimconnector(vimconn.vimconnector): if not v: # skip already deleted continue try: - if k.startswith("volume:"): - volume_id = k.strip("volume:") - if self.cinder.volumes.get(volume_id).status != 'available': + k_item, _, k_id = k.partition(":") + if k_item == "volume": + if self.cinder.volumes.get(k_id).status != 'available': keep_waiting = True else: - self.cinder.volumes.delete(volume_id) + self.cinder.volumes.delete(k_id) except Exception as e: self.logger.error("Error deleting volume: {}: {}".format(type(e).__name__, e)) if keep_waiting: -- 2.25.1