From ee2b37877d555bbd02d28606de1bb54d284698c1 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 29 Mar 2012 11:22:21 +0200 Subject: Do not fail to build a snapshot if base image is not found This fixes bug #968066 Change-Id: I1959e4dd7cb19acef54f0e857f4d8b3d40985b77 --- nova/virt/libvirt/connection.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 08a4a6fad..8dde56b60 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -592,7 +592,11 @@ class LibvirtConnection(driver.ComputeDriver): (image_service, image_id) = nova.image.get_image_service( context, instance['image_ref']) - base = image_service.show(context, image_id) + try: + base = image_service.show(context, image_id) + except exception.ImageNotFound: + base = {} + _image_service = nova.image.get_image_service(context, image_href) snapshot_image_service, snapshot_image_id = _image_service snapshot = snapshot_image_service.show(context, snapshot_image_id) @@ -608,7 +612,7 @@ class LibvirtConnection(driver.ComputeDriver): 'ramdisk_id': instance['ramdisk_id'], } } - if 'architecture' in base['properties']: + if 'architecture' in base.get('properties', {}): arch = base['properties']['architecture'] metadata['properties']['architecture'] = arch -- cgit