Fixed volume deletion error at openstack 10/5810/4
authortierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 10 Jan 2018 09:43:46 +0000 (10:43 +0100)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 22 Jan 2018 16:18:02 +0000 (17:18 +0100)
Change-Id: Icff2b4da07613fe69b8b1bbead45a01fd71fccc9
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
openmanod
osm_ro/nfvo.py
osm_ro/vimconn_openstack.py

index 51b67f3..b9858b4 100755 (executable)
--- 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',
index 3b1e4c0..a6d3ba3 100644 (file)
@@ -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 = []
index 3fd9f56..85b8dc8 100644 (file)
@@ -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: