Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a new integer property - 'mtu' - to the os_network module. #54730

Merged
merged 1 commit into from May 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,3 @@
---
minor_changes:
- os_network - added MTU support when creating/updating a network
17 changes: 14 additions & 3 deletions lib/ansible/modules/cloud/openstack/os_network.py
Expand Up @@ -76,6 +76,13 @@
not utilised.
type: bool
version_added: "2.8"
mtu:
description:
- The maximum transmission unit (MTU) value to address fragmentation.
Network will use OpenStack defaults if this option is
not provided.
type: int
version_added: "2.9"
requirements:
- "openstacksdk"
'''
Expand Down Expand Up @@ -164,7 +171,8 @@ def main():
provider_segmentation_id=dict(required=False, type='int'),
state=dict(default='present', choices=['absent', 'present']),
project=dict(default=None),
port_security_enabled=dict(type='bool')
port_security_enabled=dict(type='bool'),
mtu=dict(required=False, type='int')
)

module_kwargs = openstack_module_kwargs()
Expand All @@ -180,6 +188,7 @@ def main():
provider_segmentation_id = module.params['provider_segmentation_id']
project = module.params.get('project')
port_security_enabled = module.params.get('port_security_enabled')
mtu = module.params.get('mtu')

sdk, cloud = openstack_cloud_from_module(module)
try:
Expand Down Expand Up @@ -207,11 +216,13 @@ def main():
if project_id is not None:
net = cloud.create_network(name, shared, admin_state_up,
external, provider, project_id,
port_security_enabled=port_security_enabled)
port_security_enabled=port_security_enabled,
mtu_size=mtu)
else:
net = cloud.create_network(name, shared, admin_state_up,
external, provider,
port_security_enabled=port_security_enabled)
port_security_enabled=port_security_enabled,
mtu_size=mtu)
changed = True
else:
changed = False
Expand Down