mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloud/ovirt: set mac pools via ovirt_clusters (#28120)
MAC pools are set per cluster since ovirt 4.1. Before that it was set per data center.
This commit is contained in:
parent
3c1ee57155
commit
abc5910d86
1 changed files with 25 additions and 0 deletions
|
@ -208,6 +208,12 @@ options:
|
|||
description:
|
||||
- "The compatibility version of the cluster. All hosts in this
|
||||
cluster must support at least this compatibility version."
|
||||
mac_pool:
|
||||
description:
|
||||
- "MAC pool to be used by this cluster."
|
||||
- "C(Note:)"
|
||||
- "This is supported since oVirt version 4.1."
|
||||
version_added: 2.4
|
||||
extends_documentation_fragment: ovirt
|
||||
'''
|
||||
|
||||
|
@ -278,6 +284,7 @@ from ansible.module_utils.ovirt import (
|
|||
equal,
|
||||
ovirt_full_argument_spec,
|
||||
search_by_name,
|
||||
get_id_by_name,
|
||||
)
|
||||
|
||||
|
||||
|
@ -335,6 +342,16 @@ class ClustersModule(BaseModule):
|
|||
|
||||
return sched_policy
|
||||
|
||||
def _get_mac_pool(self):
|
||||
mac_pool = None
|
||||
if self._module.params.get('mac_pool'):
|
||||
mac_pool = search_by_name(
|
||||
self._connection.system_service().mac_pools_service(),
|
||||
self._module.params.get('mac_pool'),
|
||||
)
|
||||
|
||||
return mac_pool
|
||||
|
||||
def build_entity(self):
|
||||
sched_policy = self._get_sched_policy()
|
||||
return otypes.Cluster(
|
||||
|
@ -449,6 +466,9 @@ class ClustersModule(BaseModule):
|
|||
switch_type=otypes.SwitchType(
|
||||
self.param('switch_type')
|
||||
) if self.param('switch_type') else None,
|
||||
mac_pool=otypes.MacPool(
|
||||
id=get_id_by_name(self._connection.system_service().mac_pools_service(), self.param('mac_pool'))
|
||||
) if self.param('mac_pool') else None,
|
||||
)
|
||||
|
||||
def update_check(self, entity):
|
||||
|
@ -495,6 +515,10 @@ class ClustersModule(BaseModule):
|
|||
sorted([
|
||||
str(source) for source in entity.required_rng_sources
|
||||
])
|
||||
) and
|
||||
equal(
|
||||
get_id_by_name(self._connection.system_service().mac_pools_service(), self.param('mac_pool')),
|
||||
entity.mac_pool.id
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -543,6 +567,7 @@ def main():
|
|||
cpu_type=dict(default=None),
|
||||
switch_type=dict(default=None, choices=['legacy', 'ovs']),
|
||||
compatibility_version=dict(default=None),
|
||||
mac_pool=dict(default=None),
|
||||
)
|
||||
module = AnsibleModule(
|
||||
argument_spec=argument_spec,
|
||||
|
|
Loading…
Reference in a new issue