|
|
@ -70,7 +70,10 @@ options:
|
|
|
|
- "C(display) - I(true) if the network should marked as display network."
|
|
|
|
- "C(display) - I(true) if the network should marked as display network."
|
|
|
|
- "C(migration) - I(true) if the network should marked as migration network."
|
|
|
|
- "C(migration) - I(true) if the network should marked as migration network."
|
|
|
|
- "C(gluster) - I(true) if the network should marked as gluster network."
|
|
|
|
- "C(gluster) - I(true) if the network should marked as gluster network."
|
|
|
|
|
|
|
|
label:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- "Name of the label to assign to the network."
|
|
|
|
|
|
|
|
version_added: "2.5"
|
|
|
|
extends_documentation_fragment: ovirt
|
|
|
|
extends_documentation_fragment: ovirt
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
@ -142,7 +145,24 @@ class NetworksModule(BaseModule):
|
|
|
|
mtu=self._module.params['mtu'],
|
|
|
|
mtu=self._module.params['mtu'],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def post_create(self, entity):
|
|
|
|
|
|
|
|
self._update_label_assignments(entity)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _update_label_assignments(self, entity):
|
|
|
|
|
|
|
|
labels = [lbl.id for lbl in self._connection.follow_link(entity.network_labels)]
|
|
|
|
|
|
|
|
labels_service = self._service.service(entity.id).network_labels_service()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not self.param('label') in labels:
|
|
|
|
|
|
|
|
if not self._module.check_mode:
|
|
|
|
|
|
|
|
if labels:
|
|
|
|
|
|
|
|
labels_service.label_service(labels[0]).remove()
|
|
|
|
|
|
|
|
labels_service.add(
|
|
|
|
|
|
|
|
label=otypes.NetworkLabel(id=self.param('label'))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
self.changed = True
|
|
|
|
|
|
|
|
|
|
|
|
def update_check(self, entity):
|
|
|
|
def update_check(self, entity):
|
|
|
|
|
|
|
|
self._update_label_assignments(entity)
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
equal(self._module.params.get('comment'), entity.comment) and
|
|
|
|
equal(self._module.params.get('comment'), entity.comment) and
|
|
|
|
equal(self._module.params.get('description'), entity.description) and
|
|
|
|
equal(self._module.params.get('description'), entity.description) and
|
|
|
@ -210,6 +230,7 @@ def main():
|
|
|
|
vm_network=dict(default=None, type='bool'),
|
|
|
|
vm_network=dict(default=None, type='bool'),
|
|
|
|
mtu=dict(default=None, type='int'),
|
|
|
|
mtu=dict(default=None, type='int'),
|
|
|
|
clusters=dict(default=None, type='list'),
|
|
|
|
clusters=dict(default=None, type='list'),
|
|
|
|
|
|
|
|
label=dict(default=None),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
argument_spec=argument_spec,
|
|
|
|