Fix bug to raise vimconnException if image not found at VIM; fix bug in vimconn_opens... 74/874/3
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 5 Jan 2017 11:00:08 +0000 (12:00 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 5 Jan 2017 12:28:20 +0000 (13:28 +0100)
Change-Id: Ia4d42dc5f69f07f2f3646916cfd6d414b702c5ea
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
nfvo.py
vimconn_openstack.py

diff --git a/nfvo.py b/nfvo.py
index 0d60ff7..279eb07 100644 (file)
--- a/nfvo.py
+++ b/nfvo.py
@@ -296,9 +296,9 @@ def create_or_use_image(mydb, vims, image_dict, rollback_list, only_create_at_vi
                 #logger.debug('>>>>>>>> Filter dict: %s', str(filter_dict))
                 vim_images = vim.get_image_list(filter_dict)
                 if len(vim_images) > 1:
-                    raise NfvoException("More than one candidate VIM image found for filter: " + str(filter_dict), HTTP_Conflict)
+                    raise vimconn.vimconnException("More than one candidate VIM image found for filter: {}".format(str(filter_dict)), HTTP_Conflict)
                 elif len(vim_images) == 0:
-                    raise NfvoException("Image not found at VIM with filter: '%s'", str(filter_dict))
+                    raise vimconn.vimconnNotFoundException("Image not found at VIM with filter: '{}'".format(str(filter_dict)))
                 else:
                     image_vim_id = vim_images[0].id
 
index cdd1178..addee3a 100644 (file)
@@ -652,7 +652,7 @@ class vimconnector(vimconn.vimconnector):
             filtered_list = []
             for image in image_list:
                 image_dict=self.glance.images.get(image.id)
-                if image_dict['checksum']==filter_dict.get('checksum'):
+                if filter_dict.get('checksum') == None or image_dict['checksum']==filter_dict.get('checksum'):
                     filtered_list.append(image)
             return filtered_list
         except (ksExceptions.ClientException, nvExceptions.ClientException, gl1Exceptions.CommunicationError, ConnectionError) as e: