mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ovirt: cloud: make the datacenter input compatible (#22483)
This patch makes sure that all inputs of datacenter are compatible. So it's 'data_center' everywhere.
This commit is contained in:
parent
eb1214baad
commit
38eb388154
5 changed files with 24 additions and 24 deletions
|
@ -42,7 +42,7 @@ options:
|
||||||
- "Should the cluster be present or absent"
|
- "Should the cluster be present or absent"
|
||||||
choices: ['present', 'absent']
|
choices: ['present', 'absent']
|
||||||
default: present
|
default: present
|
||||||
datacenter:
|
data_center:
|
||||||
description:
|
description:
|
||||||
- "Datacenter name where cluster reside."
|
- "Datacenter name where cluster reside."
|
||||||
description:
|
description:
|
||||||
|
@ -214,7 +214,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Create cluster
|
# Create cluster
|
||||||
- ovirt_clusters:
|
- ovirt_clusters:
|
||||||
datacenter: mydatacenter
|
data_center: mydatacenter
|
||||||
name: mycluster
|
name: mycluster
|
||||||
cpu_type: Intel SandyBridge Family
|
cpu_type: Intel SandyBridge Family
|
||||||
description: mycluster
|
description: mycluster
|
||||||
|
@ -222,7 +222,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Create virt service cluster:
|
# Create virt service cluster:
|
||||||
- ovirt_clusters:
|
- ovirt_clusters:
|
||||||
datacenter: mydatacenter
|
data_center: mydatacenter
|
||||||
name: mycluster
|
name: mycluster
|
||||||
cpu_type: Intel Nehalem Family
|
cpu_type: Intel Nehalem Family
|
||||||
description: mycluster
|
description: mycluster
|
||||||
|
@ -424,8 +424,8 @@ class ClustersModule(BaseModule):
|
||||||
self.param('ksm') is not None
|
self.param('ksm') is not None
|
||||||
) else None,
|
) else None,
|
||||||
data_center=otypes.DataCenter(
|
data_center=otypes.DataCenter(
|
||||||
name=self.param('datacenter'),
|
name=self.param('data_center'),
|
||||||
) if self.param('datacenter') else None,
|
) if self.param('data_center') else None,
|
||||||
management_network=otypes.Network(
|
management_network=otypes.Network(
|
||||||
name=self.param('network'),
|
name=self.param('network'),
|
||||||
) if self.param('network') else None,
|
) if self.param('network') else None,
|
||||||
|
@ -525,7 +525,7 @@ def main():
|
||||||
serial_policy=dict(default=None, choices=['vm', 'host', 'custom']),
|
serial_policy=dict(default=None, choices=['vm', 'host', 'custom']),
|
||||||
serial_policy_value=dict(default=None),
|
serial_policy_value=dict(default=None),
|
||||||
scheduling_policy=dict(default=None),
|
scheduling_policy=dict(default=None),
|
||||||
datacenter=dict(default=None),
|
data_center=dict(default=None),
|
||||||
description=dict(default=None),
|
description=dict(default=None),
|
||||||
comment=dict(default=None),
|
comment=dict(default=None),
|
||||||
network=dict(default=None),
|
network=dict(default=None),
|
||||||
|
|
|
@ -233,7 +233,7 @@ def main():
|
||||||
password=dict(default=None, no_log=True),
|
password=dict(default=None, no_log=True),
|
||||||
tenant_name=dict(default=None, aliases=['tenant']),
|
tenant_name=dict(default=None, aliases=['tenant']),
|
||||||
authentication_url=dict(default=None, aliases=['auth_url']),
|
authentication_url=dict(default=None, aliases=['auth_url']),
|
||||||
data_center=dict(default=None, aliases=['data_center']),
|
data_center=dict(default=None),
|
||||||
read_only=dict(default=None, type='bool'),
|
read_only=dict(default=None, type='bool'),
|
||||||
network_type=dict(
|
network_type=dict(
|
||||||
default='external',
|
default='external',
|
||||||
|
|
|
@ -42,7 +42,7 @@ options:
|
||||||
- "Should the network be present or absent"
|
- "Should the network be present or absent"
|
||||||
choices: ['present', 'absent']
|
choices: ['present', 'absent']
|
||||||
default: present
|
default: present
|
||||||
datacenter:
|
data_center:
|
||||||
description:
|
description:
|
||||||
- "Datacenter name where network reside."
|
- "Datacenter name where network reside."
|
||||||
description:
|
description:
|
||||||
|
@ -80,7 +80,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Create network
|
# Create network
|
||||||
- ovirt_networks:
|
- ovirt_networks:
|
||||||
datacenter: mydatacenter
|
data_center: mydatacenter
|
||||||
name: mynetwork
|
name: mynetwork
|
||||||
vlan_tag: 1
|
vlan_tag: 1
|
||||||
vm_network: true
|
vm_network: true
|
||||||
|
@ -130,8 +130,8 @@ class NetworksModule(BaseModule):
|
||||||
comment=self._module.params['comment'],
|
comment=self._module.params['comment'],
|
||||||
description=self._module.params['description'],
|
description=self._module.params['description'],
|
||||||
data_center=otypes.DataCenter(
|
data_center=otypes.DataCenter(
|
||||||
name=self._module.params['datacenter'],
|
name=self._module.params['data_center'],
|
||||||
) if self._module.params['datacenter'] else None,
|
) if self._module.params['data_center'] else None,
|
||||||
vlan=otypes.Vlan(
|
vlan=otypes.Vlan(
|
||||||
self._module.params['vlan_tag'],
|
self._module.params['vlan_tag'],
|
||||||
) if self._module.params['vlan_tag'] else None,
|
) if self._module.params['vlan_tag'] else None,
|
||||||
|
@ -201,7 +201,7 @@ def main():
|
||||||
choices=['present', 'absent'],
|
choices=['present', 'absent'],
|
||||||
default='present',
|
default='present',
|
||||||
),
|
),
|
||||||
datacenter=dict(default=None, required=True),
|
data_center=dict(default=None, required=True),
|
||||||
name=dict(default=None, required=True),
|
name=dict(default=None, required=True),
|
||||||
description=dict(default=None),
|
description=dict(default=None),
|
||||||
comment=dict(default=None),
|
comment=dict(default=None),
|
||||||
|
@ -231,7 +231,7 @@ def main():
|
||||||
network = networks_module.search_entity(
|
network = networks_module.search_entity(
|
||||||
search_params={
|
search_params={
|
||||||
'name': module.params['name'],
|
'name': module.params['name'],
|
||||||
'datacenter': module.params['datacenter'],
|
'datacenter': module.params['data_center'],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
|
|
|
@ -42,7 +42,7 @@ options:
|
||||||
- "Should the quota be present/absent."
|
- "Should the quota be present/absent."
|
||||||
choices: ['present', 'absent']
|
choices: ['present', 'absent']
|
||||||
default: present
|
default: present
|
||||||
datacenter:
|
data_center:
|
||||||
description:
|
description:
|
||||||
- "Name of the datacenter where quota should be managed."
|
- "Name of the datacenter where quota should be managed."
|
||||||
required: true
|
required: true
|
||||||
|
@ -84,7 +84,7 @@ EXAMPLES = '''
|
||||||
# Add cluster quota to cluster cluster1 with memory limit 20GiB and CPU limit to 10:
|
# Add cluster quota to cluster cluster1 with memory limit 20GiB and CPU limit to 10:
|
||||||
ovirt_quotas:
|
ovirt_quotas:
|
||||||
name: quota1
|
name: quota1
|
||||||
datacenter: dcX
|
data_center: dcX
|
||||||
clusters:
|
clusters:
|
||||||
- name: cluster1
|
- name: cluster1
|
||||||
memory: 20
|
memory: 20
|
||||||
|
@ -93,7 +93,7 @@ ovirt_quotas:
|
||||||
# Add cluster quota to all clusters with memory limit 30GiB and CPU limit to 15:
|
# Add cluster quota to all clusters with memory limit 30GiB and CPU limit to 15:
|
||||||
ovirt_quotas:
|
ovirt_quotas:
|
||||||
name: quota2
|
name: quota2
|
||||||
datacenter: dcX
|
data_center: dcX
|
||||||
clusters:
|
clusters:
|
||||||
- memory: 30
|
- memory: 30
|
||||||
cpu: 15
|
cpu: 15
|
||||||
|
@ -101,7 +101,7 @@ ovirt_quotas:
|
||||||
# Add storage quota to storage data1 with size limit to 100GiB
|
# Add storage quota to storage data1 with size limit to 100GiB
|
||||||
ovirt_quotas:
|
ovirt_quotas:
|
||||||
name: quota3
|
name: quota3
|
||||||
datacenter: dcX
|
data_center: dcX
|
||||||
storage_grace: 40
|
storage_grace: 40
|
||||||
storage_threshold: 60
|
storage_threshold: 60
|
||||||
storages:
|
storages:
|
||||||
|
@ -111,7 +111,7 @@ ovirt_quotas:
|
||||||
# Remove quota quota1 (Note the quota must not be assigned to any VM/disk):
|
# Remove quota quota1 (Note the quota must not be assigned to any VM/disk):
|
||||||
ovirt_quotas:
|
ovirt_quotas:
|
||||||
state: absent
|
state: absent
|
||||||
datacenter: dcX
|
data_center: dcX
|
||||||
name: quota1
|
name: quota1
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ def main():
|
||||||
default='present',
|
default='present',
|
||||||
),
|
),
|
||||||
name=dict(required=True),
|
name=dict(required=True),
|
||||||
datacenter=dict(required=True),
|
data_center=dict(required=True),
|
||||||
description=dict(default=None),
|
description=dict(default=None),
|
||||||
cluster_threshold=dict(default=None, type='int', aliases=['cluster_soft_limit']),
|
cluster_threshold=dict(default=None, type='int', aliases=['cluster_soft_limit']),
|
||||||
cluster_grace=dict(default=None, type='int', aliases=['cluster_hard_limit']),
|
cluster_grace=dict(default=None, type='int', aliases=['cluster_hard_limit']),
|
||||||
|
@ -242,7 +242,7 @@ def main():
|
||||||
auth = module.params.pop('auth')
|
auth = module.params.pop('auth')
|
||||||
connection = create_connection(auth)
|
connection = create_connection(auth)
|
||||||
datacenters_service = connection.system_service().data_centers_service()
|
datacenters_service = connection.system_service().data_centers_service()
|
||||||
dc_name = module.params['datacenter']
|
dc_name = module.params['data_center']
|
||||||
dc_id = getattr(search_by_name(datacenters_service, dc_name), 'id', None)
|
dc_id = getattr(search_by_name(datacenters_service, dc_name), 'id', None)
|
||||||
if dc_id is None:
|
if dc_id is None:
|
||||||
raise Exception("Datacenter '%s' was not found." % dc_name)
|
raise Exception("Datacenter '%s' was not found." % dc_name)
|
||||||
|
|
|
@ -36,7 +36,7 @@ notes:
|
||||||
- "This module creates a new top-level C(ovirt_quotas) fact, which
|
- "This module creates a new top-level C(ovirt_quotas) fact, which
|
||||||
contains a list of quotas."
|
contains a list of quotas."
|
||||||
options:
|
options:
|
||||||
datacenter:
|
data_center:
|
||||||
description:
|
description:
|
||||||
- "Name of the datacenter where quota resides."
|
- "Name of the datacenter where quota resides."
|
||||||
required: true
|
required: true
|
||||||
|
@ -52,7 +52,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Gather facts about quota named C<myquota> in Default datacenter:
|
# Gather facts about quota named C<myquota> in Default datacenter:
|
||||||
- ovirt_quotas_facts:
|
- ovirt_quotas_facts:
|
||||||
datacenter: Default
|
data_center: Default
|
||||||
name: myquota
|
name: myquota
|
||||||
- debug:
|
- debug:
|
||||||
var: ovirt_quotas
|
var: ovirt_quotas
|
||||||
|
@ -81,7 +81,7 @@ from ansible.module_utils.ovirt import (
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ovirt_facts_full_argument_spec(
|
argument_spec = ovirt_facts_full_argument_spec(
|
||||||
datacenter=dict(required=True),
|
data_center=dict(required=True),
|
||||||
name=dict(default=None),
|
name=dict(default=None),
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec)
|
module = AnsibleModule(argument_spec)
|
||||||
|
@ -91,7 +91,7 @@ def main():
|
||||||
auth = module.params.pop('auth')
|
auth = module.params.pop('auth')
|
||||||
connection = create_connection(auth)
|
connection = create_connection(auth)
|
||||||
datacenters_service = connection.system_service().data_centers_service()
|
datacenters_service = connection.system_service().data_centers_service()
|
||||||
dc_name = module.params['datacenter']
|
dc_name = module.params['data_center']
|
||||||
dc = search_by_name(datacenters_service, dc_name)
|
dc = search_by_name(datacenters_service, dc_name)
|
||||||
if dc is None:
|
if dc is None:
|
||||||
raise Exception("Datacenter '%s' was not found." % dc_name)
|
raise Exception("Datacenter '%s' was not found." % dc_name)
|
||||||
|
|
Loading…
Reference in a new issue