ovirt_disk: add warning when uploading wrong format (#69153)

* ovirt_disk: add warning when wrong format

* add changelog

* Update ignore.txt
pull/69271/head
Martin Nečas 6 years ago committed by GitHub
parent 7cb8594e97
commit 1432a947e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- "ovirt_disk: add warning when uploading wrong format"

@ -58,6 +58,7 @@ options:
if you want to upload the disk even if the disk with C(id) or C(name) exists, if you want to upload the disk even if the disk with C(id) or C(name) exists,
then please use C(force) I(true). If you will use C(force) I(false), which then please use C(force) I(true). If you will use C(force) I(false), which
is default, then the disk image won't be uploaded." is default, then the disk image won't be uploaded."
- "Note that to upload iso the C(format) should be 'raw'"
version_added: "2.3" version_added: "2.3"
size: size:
description: description:
@ -73,6 +74,7 @@ options:
description: description:
- Specify format of the disk. - Specify format of the disk.
- Note that this option isn't idempotent as it's not currently possible to change format of the disk via API. - Note that this option isn't idempotent as it's not currently possible to change format of the disk via API.
default: 'cow'
choices: ['raw', 'cow'] choices: ['raw', 'cow']
content_type: content_type:
description: description:
@ -740,6 +742,8 @@ def main():
# Upload disk image in case it's new disk or force parameter is passed: # Upload disk image in case it's new disk or force parameter is passed:
if module.params['upload_image_path'] and (is_new_disk or module.params['force']): if module.params['upload_image_path'] and (is_new_disk or module.params['force']):
if module.params['format'] == 'cow' and module.params['content_type'] == 'iso':
module.warn("To upload an ISO image 'format' parameter needs to be set to 'raw'.")
uploaded = upload_disk_image(connection, module) uploaded = upload_disk_image(connection, module)
ret['changed'] = ret['changed'] or uploaded ret['changed'] = ret['changed'] or uploaded
# Download disk image in case it's file don't exist or force parameter is passed: # Download disk image in case it's file don't exist or force parameter is passed:

@ -1707,7 +1707,6 @@ lib/ansible/modules/cloud/ovirt/ovirt_datacenter_info.py validate-modules:doc-mi
lib/ansible/modules/cloud/ovirt/ovirt_disk.py future-import-boilerplate lib/ansible/modules/cloud/ovirt/ovirt_disk.py future-import-boilerplate
lib/ansible/modules/cloud/ovirt/ovirt_disk.py metaclass-boilerplate lib/ansible/modules/cloud/ovirt/ovirt_disk.py metaclass-boilerplate
lib/ansible/modules/cloud/ovirt/ovirt_disk.py validate-modules:undocumented-parameter lib/ansible/modules/cloud/ovirt/ovirt_disk.py validate-modules:undocumented-parameter
lib/ansible/modules/cloud/ovirt/ovirt_disk.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/cloud/ovirt/ovirt_disk.py validate-modules:doc-choices-do-not-match-spec lib/ansible/modules/cloud/ovirt/ovirt_disk.py validate-modules:doc-choices-do-not-match-spec
lib/ansible/modules/cloud/ovirt/ovirt_disk.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/cloud/ovirt/ovirt_disk.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/cloud/ovirt/ovirt_disk.py validate-modules:doc-missing-type lib/ansible/modules/cloud/ovirt/ovirt_disk.py validate-modules:doc-missing-type

Loading…
Cancel
Save