Added 'quota' parameter and 'description' parameter to ovirt_disk module (#33860)

* Added 'quota' field and 'description' field to ovirt_disk module

* ovirt_disk: fixed example

* quota => quota_id and other improvement
pull/18731/head
pmargara 7 years ago committed by ansibot
parent f8e3cfe9e2
commit 5a4fd97955

@ -40,6 +40,10 @@ options:
description:
- "Name of the disk to manage. Either C(id) or C(name)/C(alias) is required."
aliases: ['alias']
description:
description:
- "Description of the disk image to manage."
version_added: "2.5"
vm_name:
description:
- "Name of the Virtual Machine to manage. Either C(vm_id) or C(vm_name) is required if C(state) is I(attached) or I(detached)."
@ -108,6 +112,10 @@ options:
profile:
description:
- "Disk profile name to be attached to disk. By default profile is chosen by oVirt/RHV engine."
quota_id:
description:
- "Disk quota ID to be used for disk. By default quota is chosen by oVirt/RHV engine."
version_added: "2.5"
bootable:
description:
- "I(True) if the disk should be bootable. By default when disk is created it isn't bootable."
@ -205,6 +213,18 @@ EXAMPLES = '''
id: 7de90f31-222c-436c-a1ca-7e655bd5b60c
image_provider: myglance
state: exported
# Defining a specific quota while creating a disk image:
# Since Ansible 2.5
- ovirt_quotas_facts:
data_center: Default
name: myquota
- ovirt_disk:
name: mydisk
size: 10GiB
storage_domain: data
description: somedescriptionhere
quota_id: "{{ ovirt_quotas[0]['id'] }}"
'''
@ -430,6 +450,7 @@ class DisksModule(BaseModule):
name=self._module.params.get('storage_domain'),
),
],
quota=otypes.Quota(id=self._module.params.get('quota_id')) if self.param('quota_id') else None,
shareable=self._module.params.get('shareable'),
lun_storage=otypes.HostStorage(
type=otypes.StorageType(
@ -498,6 +519,7 @@ class DisksModule(BaseModule):
def _update_check(self, entity):
return (
equal(self._module.params.get('description'), entity.description) and
equal(self.param('quota_id'), getattr(entity.quota, 'id')) and
equal(convert_to_bytes(self._module.params.get('size')), entity.provisioned_size) and
equal(self._module.params.get('shareable'), entity.shareable)
)
@ -531,6 +553,7 @@ def main():
),
id=dict(default=None),
name=dict(default=None, aliases=['alias']),
description=dict(default=None),
vm_name=dict(default=None),
vm_id=dict(default=None),
size=dict(default=None),
@ -538,6 +561,7 @@ def main():
storage_domain=dict(default=None),
storage_domains=dict(default=None, type='list'),
profile=dict(default=None),
quota_id=dict(default=None),
format=dict(default='cow', choices=['raw', 'cow']),
bootable=dict(default=None, type='bool'),
shareable=dict(default=None, type='bool'),

@ -39,7 +39,7 @@ options:
pattern:
description:
- "Search term which is accepted by oVirt/RHV search backend."
- "For example to search Disk X from storafe Y use following pattern:
- "For example to search Disk X from storage Y use following pattern:
name=X and storage.name=Y"
extends_documentation_fragment: ovirt_facts
'''

Loading…
Cancel
Save