From: garciadeblas Date: Mon, 9 Jan 2017 08:46:31 +0000 (+0100) Subject: Allow images without checksum in the VIM; fixed image lookup in Opesntack connector X-Git-Tag: v1.0.4~4 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=30833385bfbc39d8cd0d4cdac14bd86fc956f1a6;p=osm%2FRO.git Allow images without checksum in the VIM; fixed image lookup in Opesntack connector Change-Id: Iedacddf3b7b32df344bb800db535a85f0106d856 Signed-off-by: garciadeblas --- diff --git a/nfvo.py b/nfvo.py index 279eb073..a1279694 100644 --- a/nfvo.py +++ b/nfvo.py @@ -290,9 +290,10 @@ def create_or_use_image(mydb, vims, image_dict, rollback_list, only_create_at_vi if image_dict['location'] is not None: image_vim_id = vim.get_image_id_from_path(image_dict['location']) else: - filter_dict={} - filter_dict['name']=image_dict['universal_name'] - filter_dict['checksum']=image_dict['checksum'] + filter_dict = {} + filter_dict['name'] = image_dict['universal_name'] + if image_dict.get('checksum') != None: + filter_dict['checksum'] = image_dict['checksum'] #logger.debug('>>>>>>>> Filter dict: %s', str(filter_dict)) vim_images = vim.get_image_list(filter_dict) if len(vim_images) > 1: @@ -321,7 +322,7 @@ def create_or_use_image(mydb, vims, image_dict, rollback_list, only_create_at_vi raise logger.warn("Error contacting VIM to know if the image exists at VIM: %s", str(e)) image_vim_id = None - continue + continue #if we reach here, the image has been created or existed if len(image_db)==0: #add new vim_id at datacenters_images @@ -1761,6 +1762,7 @@ def create_instance(mydb, tenant_id, instance_dict): myvims[d] = v datacenter2tenant[d] = v['config']['datacenter_tenant_id'] scenario_vnf["datacenter"] = vnf_instance_desc["datacenter"] + #0.1 parse cloud-config parameters cloud_config = scenarioDict.get("cloud-config", {}) if instance_dict.get("cloud-config"): diff --git a/vimconn_openstack.py b/vimconn_openstack.py index addee3a9..2607e3f6 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 filter_dict.get('checksum') == None or image_dict['checksum']==filter_dict.get('checksum'): + if 'checksum' in filter_dict and image_dict['checksum']==filter_dict.get('checksum'): filtered_list.append(image) return filtered_list except (ksExceptions.ClientException, nvExceptions.ClientException, gl1Exceptions.CommunicationError, ConnectionError) as e: