From 589178f739356d9abd2f82e14a1cec8d487f0784 Mon Sep 17 00:00:00 2001 From: Jerry Cai Date: Mon, 22 Dec 2014 11:07:08 +0800 Subject: [PATCH] Fail to snapshot PowerVC image When powervc driver found there is no or deleted image associated during sync instances, it will set a default image which causes exploiter crash, this patch will keep original image_ref when no related image found. Change-Id: I191d31cfdecaedd22b449728be732ca54057c5f9 Closes-Bug: 1404777 --- .../powervc/nova/driver/compute/manager.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nova-powervc/powervc/nova/driver/compute/manager.py b/nova-powervc/powervc/nova/driver/compute/manager.py index 0b64ab4..b488674 100644 --- a/nova-powervc/powervc/nova/driver/compute/manager.py +++ b/nova-powervc/powervc/nova/driver/compute/manager.py @@ -748,8 +748,20 @@ class PowerVCCloudManager(manager.Manager): if rtn is not None: break + """TODO: This fix doesn't handle the case that user delete the image + from PowerVC, and such image has associated VM in PowerVC, then those + PowerVC instances synced to PowerVC will still associated a default + image id with that instance. + """ if rtn is None: - rtn = self.get_default_image(ctx) + if db_instance is not None: + LOG.warning("No local image found: %s, skip updating image_ref" + % db_instance.get('image_ref')) + local_image = {} + local_image['id'] = db_instance.get('image_ref') + return local_image + else: + rtn = self.get_default_image(ctx) return rtn