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
This commit is contained in:
Jerry Cai 2014-12-22 11:07:08 +08:00
parent 3699879307
commit 589178f739
1 changed files with 13 additions and 1 deletions

View File

@ -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