From: garciadeblas Date: Thu, 5 Jan 2017 11:00:08 +0000 (+0100) Subject: Fix bug to raise vimconnException if image not found at VIM; fix bug in vimconn_opens... X-Git-Tag: v1.0.4~7 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F74%2F874%2F3;p=osm%2FRO.git Fix bug to raise vimconnException if image not found at VIM; fix bug in vimconn_openstack to accept image lookups only by name Change-Id: Ia4d42dc5f69f07f2f3646916cfd6d414b702c5ea Signed-off-by: garciadeblas --- diff --git a/nfvo.py b/nfvo.py index 0d60ff72..279eb073 100644 --- 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 diff --git a/vimconn_openstack.py b/vimconn_openstack.py index cdd11784..addee3a9 100644 --- a/vimconn_openstack.py +++ b/vimconn_openstack.py @@ -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: