From 3fa2c05cbd54df361cb85ffde330243663679fe1 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 5 Jan 2017 12:00:08 +0100 Subject: [PATCH] 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 --- nfvo.py | 4 ++-- vimconn_openstack.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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: -- 2.25.1