@ -26,7 +26,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.0',
DOCUMENTATION = '''
- - -
module : ovirt_disk s
module : ovirt_disk
short_description : " Module to manage Virtual Machine and floating disks in oVirt/RHV "
version_added : " 2.2 "
author : " Ondra Machacek (@machacekondra) "
@ -147,7 +147,7 @@ EXAMPLES = '''
# look at ovirt_auth module to see how to reuse authentication:
# Create and attach new disk to VM
- ovirt_disk s :
- ovirt_disk :
name : myvm_disk
vm_name : rhel7
size : 10 GiB
@ -155,7 +155,7 @@ EXAMPLES = '''
interface : virtio
# Attach logical unit to VM rhel7
- ovirt_disk s :
- ovirt_disk :
vm_name : rhel7
logical_unit :
target : iqn .2016 - 08 - 09. brq . str - 01 : omachace
@ -164,7 +164,7 @@ EXAMPLES = '''
interface : virtio
# Detach disk from VM
- ovirt_disk s :
- ovirt_disk :
state : detached
name : myvm_disk
vm_name : rhel7
@ -174,7 +174,7 @@ EXAMPLES = '''
# Upload local image to disk and attach it to vm:
# Since Ansible 2.3
- ovirt_disk s :
- ovirt_disk :
name : mydisk
vm_name : myvm
interface : virtio
@ -185,7 +185,7 @@ EXAMPLES = '''
# Download disk to local file system:
# Since Ansible 2.3
- ovirt_disk s :
- ovirt_disk :
id : 7 de90f31 - 222 c - 436 c - a1ca - 7e655 bd5b60c
download_image_path : / home / user / mydisk . qcow2
'''
@ -541,6 +541,10 @@ def main():
argument_spec = argument_spec ,
supports_check_mode = True ,
)
if module . _name == ' ovirt_disks ' :
module . deprecate ( " The ' ovirt_disks ' module is being renamed ' ovirt_disk ' " , version = 2.8 )
check_sdk ( module )
check_params ( module )
@ -579,8 +583,7 @@ def main():
ret [ ' changed ' ] = ret [ ' changed ' ] or uploaded
# Download disk image in case it's file don't exist or force parameter is passed:
if (
module . params [ ' download_image_path ' ]
and ( not os . path . isfile ( module . params [ ' download_image_path ' ] ) or module . params [ ' force ' ] )
module . params [ ' download_image_path ' ] and ( not os . path . isfile ( module . params [ ' download_image_path ' ] ) or module . params [ ' force ' ] )
) :
downloaded = download_disk_image ( connection , module )
ret [ ' changed ' ] = ret [ ' changed ' ] or downloaded
@ -623,7 +626,7 @@ def main():
if lun is None :
wait (
service = disk_attachments_service . service ( ret [ ' id ' ] ) ,
condition = lambda d : follow_link ( connection , d . disk ) . status == otypes . DiskStatus . OK ,
condition = lambda d : follow_link ( connection , d . disk ) . status == otypes . DiskStatus . OK ,
wait = module . params [ ' wait ' ] ,
timeout = module . params [ ' timeout ' ] ,
)