RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1471805 - ethmonitor reports 'WARNING: Interface xxx does not exist' for existing interfaces
Summary: ethmonitor reports 'WARNING: Interface xxx does not exist' for existing inter...
Keywords:
Status: CLOSED DUPLICATE of bug 1408656
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: resource-agents
Version: 7.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Oyvind Albrigtsen
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-17 13:23 UTC by Ondrej Faměra
Modified: 2020-09-10 10:57 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-17 14:35:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed fix (550 bytes, patch)
2017-07-17 13:23 UTC, Ondrej Faměra
no flags Details | Diff

Description Ondrej Faměra 2017-07-17 13:23:10 UTC
Created attachment 1299859 [details]
proposed fix

=== Description of problem:
'ethmonitor' resource agents reports warning 'WARNING: Interface xxx does not exist' if the
interface specified for it doesn't contain any IP addresses. This message is both misleading
and not true. See attachment for proposed patch on fixing the correct detection in this special
case.

=== Version-Release number of selected component (if applicable):
resource-agents-3.9.5-82.el7_3.11.x86_64

=== How reproducible:
always

=== Steps to Reproduce:
1. Ensure that interface 'eth2' exists on the system and that it doesn't
have any IP address assigned. Output from 'ip addr show' below.
  ...
  2: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
      link/ether 52:54:00:dc:dc:7b brd ff:ff:ff:ff:ff:ff
  ...
Note that 'eth2' is not seen in output of 'ip -o -f inet addr show'.

2. Create resource 'ethmonitor' and give it following attributes.
  # pcs resource create ethmonitor interface=eth2 link_status_only=1

3. Observe the logs.

=== Actual results:
Logs contain following warning after each monitoring cycle of the resource.
  ethmonitor(eth)[xxxx]: WARNING: Interface eth2 does not exist

=== Expected results:
No WARNING should be reported in logs as the interface exists.

=== Additional info:
/usr/lib/ocf/resource.d/heartbeat/ethmonitor

### Resource agent executes 'if_validate' on each call except of meta-data, usage and help
528 case $__OCF_ACTION in
529 meta-data)      meta_data
530                 ;;
531 usage|help)     if_usage
532                 exit $OCF_SUCCESS
533                 ;;
534 esac
535
536 if_validate

### 'if_validate' calls 'if_init'
522 if_validate() {
523         check_binary $IP2UTIL
524         check_binary arping
525         if_init
526 }

### 'if_init' calls to 'is_interface' to validate the interface and if it fails it prodduces warnign on line 251
237         if is_interface $NIC
238         then
239                 case "$NIC" in
240                         *:*) ocf_exit_reason "Do not specify a virtual interface : $OCF_RESKEY_interface"
241                                  exit $OCF_ERR_CONFIGURED;;
242                         *)   ;;
243                 esac
244         else
245                 case $__OCF_ACTION in
246                         validate-all)
247                                 ocf_exit_reason "Interface $NIC does not exist"
248                                 exit $OCF_ERR_CONFIGURED;;
249                         *)
250                                 ## It might be a bond interface which is temporarily not available, therefore we want to continue here
251                                 ocf_log warn "Interface $NIC does not exist"
252                                 ;;
253                 esac
254         fi

### Valid interface numbers are determined in functions 'is_interface' that doesn't shows any interface without IP addresses.
205 is_interface() {
206	#
207	# List interfaces but exclude FreeS/WAN ipsecN virtual interfaces
208	#
209	local iface=`$IP2UTIL -o -f inet addr show | grep " $1 " \
210		| cut -d ' ' -f2 | sort -u | grep -v '^ipsec[0-9][0-9]*$'`
211		[ "$iface" != "" ]
212 }

==============
Proposed patch to 'ethmonitor' attached to this bugzilla.

Patch changes the family that 'ip' searches for the interfaces.
Instead of '-f inet' it uses '-f link'.
Due to change of family all interfaces have now ':' (colon) at the end.
Still interfaces are separated by spaces around so the code is made to account
that in 2 places. 1st when grep-ing for the requested interface and 2nd when we have
results it is removing the ':' from results to produce same type of output as previous
version of this command.
Patch seems to work well for scenario described in the 'Steps to reproduce' and also
works well in scenario when we use it for interfaces with IP addresses. 
However based on what are other accepted inputs as interface names more testing would be
probably needed.

Comment 2 Oyvind Albrigtsen 2017-07-17 14:35:38 UTC
This is being taken care of in https://bugzilla.redhat.com/show_bug.cgi?id=1408656

*** This bug has been marked as a duplicate of bug 1408656 ***


Note You need to log in before you can comment on or make changes to this bug.