summaryrefslogtreecommitdiff
path: root/openstackclient/image
diff options
context:
space:
mode:
authorNicolas Simonds <nic@metacloud.com>2016-03-18 16:04:07 -0700
committerNicolas Simonds <nic@metacloud.com>2016-03-18 16:08:30 -0700
commit1d1c7a06311f49a8a1adfc2431871f686af18af4 (patch)
treed8cccc0fff6fab0a47eb475c3fb28e187b8ea652 /openstackclient/image
parentf9f6abe56414a56ea28863ad5824a5c176a75b33 (diff)
downloadpython-openstackclient-1d1c7a06311f49a8a1adfc2431871f686af18af4.tar.gz
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
Diffstat (limited to 'openstackclient/image')
-rw-r--r--openstackclient/image/v2/image.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index 3f162181..40ddd4b9 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -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)