Image API v2: make volume_type optional

It is perfectly valid for a Cinder volume to have a volume_type of
"none", so don't make the Image API v2 require that one be set.

Change-Id: I1a6da8d791fa0ae67cac46eec81bcbcb420729c3
Closes-Bug: #1559344
This commit is contained in:
Nicolas Simonds 2016-03-18 16:04:07 -07:00
parent f9f6abe564
commit 1d1c7a0631

View File

@ -325,7 +325,10 @@ class CreateImage(command.ShowOne):
parsed_args.disk_format,
)
info = body['os-volume_upload_image']
info['volume_type'] = info['volume_type']['name']
try:
info['volume_type'] = info['volume_type']['name']
except TypeError:
info['volume_type'] = None
else:
image = image_client.images.create(**kwargs)