Do not sync bdm from pvc image to local image properties

Do not sync bdm from pvc image to local image properties,
neither do sync from local to pvc, or it will break on both
pvc side and local os side.

Change-Id: I0bdd124c8e3897917050c6927e20ab358f30b65e
Closes-Bug: #1438547
This commit is contained in:
Jerry Cai 2015-03-31 15:02:45 +08:00
parent d6275551c5
commit eac3b89426
2 changed files with 22 additions and 0 deletions

View File

@ -94,3 +94,6 @@ SYNC_PASSED = 1
SYNC_FAILED = -1
IMAGE_SYNC_RETRY_INTERVAL_TIME_IN_SECONDS = 60
IMAGE_SYNC_CHECK_INTERVAL_TIME_IN_SECONDS = 1
# Block Device Mapping Key in image properties
BDM_KEY = 'block_device_mapping'

View File

@ -1473,6 +1473,10 @@ class PowerVCImageManager(service.Service):
# Community fix needs the property 'checksum' must be set
field_dict['checksum'] = self._get_image_checksum(
src_image.to_dict())
# We do not want to update bdm from pvc during adding image
if constants.BDM_KEY in field_dict.get('properties'):
del(field_dict['properties'][constants.BDM_KEY])
new_image = v1images.create(**field_dict)
updated_image = None
if len(update_field_dict) > 0:
@ -1780,6 +1784,15 @@ class PowerVCImageManager(service.Service):
field_dict[imagekey] = field_value
else:
patch_dict[imagekey] = field_value
# We do not want to update bdm from pvc and
# we do not want to update the empty bdm info to pvc
if remove_list and constants.BDM_KEY in remove_list:
remove_list.remove(constants.BDM_KEY)
if field_dict and constants.BDM_KEY in field_dict:
del(field_dict[constants.BDM_KEY])
if patch_dict and constants.BDM_KEY in patch_dict:
del(patch_dict[constants.BDM_KEY])
return field_dict, patch_dict, remove_list
def _filter_v1image_properties(self, props):
@ -2048,6 +2061,12 @@ class PowerVCImageManager(service.Service):
else:
remove_list = None
# We do not want to update bdm from pvc and
# we do not want to update the empty bdm info to pvc
if constants.BDM_KEY in remove_list:
remove_list.remove(constants.BDM_KEY)
if add_update_dict and constants.BDM_KEY in add_update_dict:
del(add_update_dict[constants.BDM_KEY])
return add_update_dict, remove_list
def _filter_v1image_for_v2_update(self, v1image_dict):