Bug 1503059 - Primary interface being a bond creates invalid host interfaces
Summary: Primary interface being a bond creates invalid host interfaces
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Networking
Version: 6.5.0
Hardware: x86_64
OS: Linux
urgent
high
Target Milestone: 6.7.0
Assignee: satellite6-bugs
QA Contact: Stephen Wadeley
URL:
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2017-10-17 09:38 UTC by Peter Vreman
Modified: 2020-07-15 00:28 UTC (History)
18 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-14 13:22:23 UTC
Target Upstream Version:


Attachments (Terms of Use)
Proposed patch (3.46 KB, patch)
2017-10-17 15:46 UTC, Peter Vreman
no flags Details | Diff
Proposed patch - foreman 1.15 (3.40 KB, patch)
2017-11-22 21:33 UTC, Peter Vreman
no flags Details | Diff
Proposed patch for sat650beta foreman1.20 (4.91 KB, patch)
2019-04-30 21:32 UTC, Peter Vreman
no flags Details | Diff
bond0 shown correctly in web UI (33.79 KB, image/png)
2020-01-29 21:16 UTC, Stephen Wadeley
no flags Details


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 26727 Urgent Closed Bond interfaces as primary nic create invalid records 2020-11-25 14:02:40 UTC
Github theforeman foreman pull 6731 'None' closed Fixes #26727 - Fix issue with primary interface on bond 2020-11-25 14:02:40 UTC
Red Hat Knowledge Base (Solution) 4155091 None None None 2020-07-15 00:28:50 UTC
Red Hat Product Errata RHSA-2020:1454 None None None 2020-04-14 13:22:43 UTC

Description Peter Vreman 2017-10-17 09:38:52 UTC
Description of problem:
When a client has the primary interface on a bond the bond0 is not in the interfaces list when the client is uploads the facts thorugh the puppet ENC.

The root cuase is the foreman code to initialize a new host initializes the primary interface as a NIC::Managed class:

    def build_required_interfaces(attrs = {})
      self.interfaces.build(attrs.merge(:primary => true, :type => 'Nic::Managed')) if self.primary_interface.nil?
      self.primary_interface.provision = true if self.provision_interface.nil?
    end

This is wrong, because for a bond it must be the sub class Nic::Bond




Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. create a host with a bond0 interface mode=0 with the ip address and add one slave (enough to test) 
2. delete the host in foreman 
3. run puppet to upload the facts, this should create through the puppet ENC the host in foreman
4. check the interfaces of the host, the bond0 is missing


Actual results:


Expected results:


Additional info:
There is a warning inside the code 'Saving bond0 NIC for host xxx.xxx failed, skipping because:'  but this is not emitted to the log file, i have created a separate https://bugzilla.redhat.com/show_bug.cgi?id=1503052 for this

Comment 1 Peter Vreman 2017-10-17 15:46:33 UTC
Created attachment 1339798 [details]
Proposed patch

Attached is a proposed patch that parses the facts and then gives the suggested primary interface to the new host creation process. Based on this suggested primary interface the right Nic subclass is then instantiated

Comment 5 Peter Vreman 2017-11-22 21:33:48 UTC
Created attachment 1357863 [details]
Proposed patch - foreman 1.15

Updated patch for foreman 1.15.6

Comment 15 Dana Safford 2018-06-22 20:36:21 UTC
Hi folks,

Looks like it's been a month with no updates.

We need to push this and provide a meaningful update, please.

I'm setting the customer escalation flag.

Comment 20 Peter Vreman 2018-08-22 06:34:04 UTC
Any news? At least todays code on github https://github.com/theforeman/foreman/blob/develop/app/models/host/base.rb#L391 is still broken as it creates always NIC::Managed instead of the result of interface_class(name) as defined in 
https://github.com/theforeman/foreman/blob/develop/app/models/host/base.rb#L503

Comment 30 Peter Vreman 2019-04-30 21:32:53 UTC
Created attachment 1560530 [details]
Proposed patch for sat650beta foreman1.20

Rebased patch for foreman 1.20 part of sat6.5.0beta

Comment 31 Oliver Falk 2019-05-02 09:23:34 UTC
Hi Peter!

Thanks for updating the (proposed) patch against RHSAT6.5 / Foreman 1.20.
Since I wasn't able to find this addressed upstream, I took the opportunity to move this upstream:

https://github.com/theforeman/foreman/pull/6731

That could mean I get back to you with additional questions, should the pop up there.

Kind regards,
 Oliver

Comment 32 Oliver Falk 2019-05-02 09:24:33 UTC
Foreman issue for the same: https://projects.theforeman.org/issues/26727

Comment 33 Bryan Kearney 2019-08-01 12:01:52 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26727 has been resolved.

Comment 34 Oliver Falk 2019-08-01 12:07:41 UTC
Please note that my initial fix was enhanced by Timo Goebel with https://github.com/theforeman/foreman/pull/6933 and this one was merged.

Comment 35 Stephen Wadeley 2020-01-27 09:14:27 UTC
Hello

While testing:
Bug 1769898 - Unable to register a machine with bonded primary interface
Bug 1766344 - Unable to register a machine with bonded primary interface

I raised:
Identifier is blank when registering over a bond https://projects.theforeman.org/issues/28376

As https://projects.theforeman.org/issues/26727 is attached to this bug and Bug 1766344, does that not mean this is a duplicate of Bug 1766344?

Thank you

Comment 36 Stephen Wadeley 2020-01-27 11:24:56 UTC
Hello

taking QA role as requested by rplevka

Comment 37 Stephen Wadeley 2020-01-29 16:38:22 UTC
(In reply to Stephen Wadeley from comment #35)
<snip>
> 
> As https://projects.theforeman.org/issues/26727 is attached to this bug and
> Bug 1766344, does that not mean this is a duplicate of Bug 1766344?
> 
lzap says no, because "Although some code is shared, one is rhsm client and the
other is puppet client."

Comment 38 Stephen Wadeley 2020-01-29 21:15:18 UTC
Hello

Testing with latest snap
[root@dell-r330-12 ~]# rpm -q satellite
satellite-6.7.0-5.beta.el7sat.noarch

-------------------------------------------------------------
On a RHEl7 host:

[root@bond-test ~]# hostname
bond-test.gsslab.brq.redhat.com

[root@bond-test ~]# nmcli con add type bond ifname bond0
Connection 'bond-bond0' (5b8bf287-8190-46f0-872d-29c9011eee06) successfully added.

mode=0 is balance-rr and is the default.
---------------------------------------

[root@bond-test ~]# nmcli -f bond.options con show bond-bond0 
bond.options:                           mode=balance-rr

[root@bond-test ~]# nmcli con add type ethernet ifname eth1 master bond0
Connection 'bond-slave-eth1' (08c2a961-1c9c-4112-aafe-95c644432ebb) successfully added.

[root@bond-test ~]# nmcli -f IP4.ADDRESS con show bond-bond0
IP4.ADDRESS[1]:                         192.168.100.11/24


log out and back in over the bond
-----------------------------------

[root@dell-r330-12 ~]# ssh root@192.168.100.11
The authenticity of host '192.168.100.11 (192.168.100.11)' can't be established.
ECDSA key fingerprint is SHA256:iL/V+VXlq/SbcNURCBaICzIbEssSIXYRoSwbWa9+5X0.
ECDSA key fingerprint is MD5:88:fa:ad:31:de:ec:7a:ec:06:0b:f8:4d:12:aa:21:96.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.100.11' (ECDSA) to the list of known hosts.
root@192.168.100.11's password: 
Last login: Wed Jan 29 20:42:33 2020 from gateway

Set down the other interface
-----------------------------------

[root@bond-test ~]# ifdown eth0 
Device 'eth0' successfully disconnected

[root@bond-test ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:7b:25:77 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
    link/ether 52:54:00:34:3a:85 brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:34:3a:85 brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.11/24 brd 192.168.100.255 scope global noprefixroute dynamic bond0
       valid_lft 42512sec preferred_lft 42512sec
    inet6 fe80::cd34:feab:77eb:2d3b/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
[root@bond-test ~]# 

Test starts here
----------------

comment 0 does not mention registration but thats implied (otherwise how would you delete it)

[root@bond-test ~]# rpm -Uvh http://dell-r330-12.gsslab.brq.redhat.com/pub/katello-ca-consumer-latest.noarch.rpm
Retrieving http://dell-r330-12.gsslab.brq.redhat.com/pub/katello-ca-consumer-latest.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:katello-ca-consumer-dell-r330-12.################################# [100%]
[root@bond-test ~]# 

[root@bond-test ~]# subscription-manager register --org="Default_Organization" --activationkey="ak-rhel-7" --force
Unregistering from: dell-r330-12.gsslab.brq.redhat.com:443/rhsm
The system with UUID 66cd5a9e-5f24-46f0-b9ec-4a3c03aa757c has been unregistered
All local data removed
The system has been registered with ID: f337e645-1a40-4b89-b171-87170ba0cedb
The registered system name is: bond-test.gsslab.brq.redhat.com



[root@bond-test ~]# yum install puppet-agent

[root@bond-test ~]# vi /etc/puppetlabs/puppet/puppet.conf  # as per guide [1]
[root@bond-test ~]# puppet agent -t
# sign the cert in web UI
[root@bond-test ~]# puppet agent -t


Delete the host in Satellite
----------------------------

[root@dell-r330-12 ~]# hammer host list
2  | bond-test.gsslab.brq.redhat.com    | RedHat 7.7       |            | 192.168.100.11 | 52:54:00:34:3a:85

[root@dell-r330-12 ~]# hammer host delete --id 2
Host deleted.

Run puppet again
-------------------

[root@bond-test ~]# puppet agent -t
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 500 on SERVER: Server Error: Failed to find bond-test.gsslab.brq.redhat.com via exec: Execution of '/etc/puppetlabs/puppet/node.rb bond-test.gsslab.brq.redhat.com' returned 1: 

[root@dell-r330-12 ~]# hammer host list

3  | bond-test.gsslab.brq.redhat.com    | RedHat 7.7       |            | 192.168.100.11 | 52:54:00:34:3a:85

[root@dell-r330-12 ~]# hammer host info --id 3
Id:                       3
Name:                     bond-test.gsslab.brq.redhat.com
Organisation:             Default Organization
Location:                 Default Location
Puppet Environment:       production
Puppet CA Proxy:          dell-r330-12.gsslab.brq.redhat.com
Puppet Master Proxy:      dell-r330-12.gsslab.brq.redhat.com
Cert name:                bond-test.gsslab.brq.redhat.com
Managed:                  no
Installed at:             
Last report:              2020/01/29 21:06:39
Uptime (seconds):         9193
Status:                   
    Global Status: OK
Network:                  
    IPv4 address: 192.168.100.11
    MAC:          52:54:00:34:3a:85
    Domain:       gsslab.brq.redhat.com
Network interfaces:       
 1) Id:           8
    Identifier:   bond0
    Type:         bond (primary, provision)
    MAC address:  52:54:00:34:3a:85
    IPv4 address: 192.168.100.11
    FQDN:         bond-test.gsslab.brq.redhat.com
 2) Id:          9
    Identifier:  eth0
    Type:        interface
    MAC address: 52:54:00:7b:25:77
    FQDN:
 3) Id:          10
    Identifier:  eth1
    Type:        interface
    MAC address: 52:54:00:34:3a:85
    FQDN:
Operating system:         
    Architecture:           x86_64
    Operating System:       RedHat 7.7
    Build:                  no
    Custom partition table:
Parameters:               

All parameters:           
    enable-puppet5 => true
    enable-epel => false


In the web UI I can see bond0 entry. Screen capture will be attached next.

[1] https://access.redhat.com/documentation/en-us/red_hat_satellite/6.6/html/managing_hosts/registering_hosts#installing-and-configuring-the-puppet-agent

Comment 39 Stephen Wadeley 2020-01-29 21:16:20 UTC
Created attachment 1656401 [details]
bond0 shown correctly in web UI

Comment 42 errata-xmlrpc 2020-04-14 13:22:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1454


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