Fix bug for ensuring attr of image_info is not None

First get the image_info, if the status of image is 'queued',
some image attributes like disk_format could be 'None',
so we need to get the image_info again.

Change-Id: I2f90acbf1800062cb7004795f9d1b2a93a408e82
This commit is contained in:
fudunwei 2020-07-28 16:56:17 +08:00
parent 0764f5dab1
commit cb1d947d6f
1 changed files with 1 additions and 0 deletions

View File

@ -108,6 +108,7 @@ class ProtectOperation(protection_plugin.Operation):
reason="The status of image is invalid.",
resource_id=image_id,
resource_type=constants.IMAGE_RESOURCE_TYPE)
image_info = glance_client.images.get(image_id)
image_metadata = {
"disk_format": image_info.disk_format,
"container_format": image_info.container_format,