diff options
author | Nijin Ashok <nashok@redhat.com> | 2017-08-23 18:14:51 +0530 |
---|---|---|
committer | Ryan Brown <sb@ryansb.com> | 2017-08-23 08:44:51 -0400 |
commit | 3c1ee571557ed1ffbec0739f468a03f8706da0ba (patch) | |
tree | 90718665efc547658462e35f8e580033d8f0ee4c | |
parent | 07feec30d38539bec814ad215c4d9267cd794444 (diff) | |
download | ansible-3c1ee571557ed1ffbec0739f468a03f8706da0ba.tar.gz |
[cloud] ovirt: Add VM lease option to the ovirt_vms module (#27710)
Ovirt 4.1 is having new feature of VM lease for high availability.
The commit add support for configuring this in ovirt_vms module.
-rw-r--r-- | lib/ansible/modules/cloud/ovirt/ovirt_vms.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vms.py b/lib/ansible/modules/cloud/ovirt/ovirt_vms.py index a38246476a..d554034ff5 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_vms.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_vms.py @@ -138,6 +138,11 @@ options: - "If I(True) Virtual Machine will be set as highly available." - "If I(False) Virtual Machine won't be set as highly available." - "If no value is passed, default value is set by oVirt/RHV engine." + lease: + description: + - "Name of the storage domain this virtual machine lease reside on." + - "C(Note): Supported since oVirt 4.1." + version_added: "2.4" delete_protected: description: - "If I(True) Virtual Machine will be set as delete protected." @@ -649,6 +654,14 @@ class VmsModule(BaseModule): high_availability=otypes.HighAvailability( enabled=self.param('high_availability') ) if self.param('high_availability') is not None else None, + lease=otypes.StorageDomainLease( + storage_domain=otypes.StorageDomain( + id=get_id_by_name( + service=self._connection.system_service().storage_domains_service(), + name=self.param('lease') + ) + ) + ) if self.param('lease') is not None else None, cpu=otypes.Cpu( topology=otypes.CpuTopology( cores=self.param('cpu_cores'), @@ -707,6 +720,7 @@ class VmsModule(BaseModule): and equal(self.param('type'), str(entity.type)) and equal(self.param('operating_system'), str(entity.os.type)) and equal(self.param('high_availability'), entity.high_availability.enabled) + and equal(self.param('lease'), get_link_name(self._connection, getattr(entity.lease, 'storage_domain', None))) and equal(self.param('stateless'), entity.stateless) and equal(self.param('cpu_shares'), entity.cpu_shares) and equal(self.param('delete_protected'), entity.delete_protected) @@ -1123,6 +1137,7 @@ def main(): cd_iso=dict(default=None), boot_devices=dict(default=None, type='list'), high_availability=dict(type='bool'), + lease=dict(default=None), stateless=dict(type='bool'), delete_protected=dict(type='bool'), force=dict(type='bool', default=False), |