Merge "Add the MTU size to ping to catch network issues" into stable/wallaby

This commit is contained in:
Zuul 2021-12-07 20:01:44 +00:00 committed by Gerrit Code Review
commit 87dde6ff9f
2 changed files with 46 additions and 4 deletions

View File

@ -46,13 +46,10 @@
- tripleo_nodes_validation_ping_test_gateway_ips | length > 0
- name: Check Controllers availability
command: "{{ (':' in controller) | ternary('ping6', 'ping') }} -w 10 -c 1 {{ controller }}"
retries: 10
delay: 60
include_tasks: ping.yml
loop_control:
loop_var: controller
loop: "{{ tripleo_nodes_validation_ping_test_ips }}"
changed_when: false
when:
- tripleo_nodes_validation_validate_controllers_icmp|bool
- tripleo_nodes_validation_ping_test_ips | length > 0

View File

@ -0,0 +1,45 @@
---
# Copyright 2021 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Set IP options
set_fact:
_sed_opts: "'s/.*dev \\([^ ]*\\).*/\\1/') "
_ping_cmd: "{{ (':' in controller) | ternary('ping6', 'ping') }}"
- name: Lookup interface information
register: _nic_mtu
shell: |
INT=$(ip ro get {{ controller }} | head -1 | sed '{{ _sed_opts }}')
MTU=$(cat /sys/class/net/${INT}/mtu 2>/dev/null || echo "0")
echo "$INT $MTU"
- name: Set interface vars
set_fact:
_nic: "{{ _nic_mtu.get('stdout', '').split(' ')[0] | default('lo') }}"
_mtu: "{{ _nic_mtu.get('stdout', '').split(' ')[1] | default(0) | int - 28 }}"
- name: Network availability validation block
block:
- name: Check IP responsiveness
command: "{{ _ping_cmd }} -w 10 -c 1 {{ controller }}"
retries: 10
delay: 60
changed_when: false
- name: Validate packet with {{ _mtu }} MTU size can reach controller from {{ _nic }}
command: "{{ _ping_cmd }} -w 10 -s {{ _mtu }} -c 1 {{ controller }}"
retries: 10
delay: 60
changed_when: false
when: _mtu | int > 0
when: _nic != 'lo'