Bug 1136843

Summary: NetworkManager ifups VDSM's reference bond
Product: Red Hat Enterprise Linux 7 Reporter: Ondřej Svoboda <osvoboda>
Component: NetworkManagerAssignee: Jirka Klimes <jklimes>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: bazulay, danken, danw, dcbw, jklimes, lvernia, rkhan, s.kieske, thaller, vbenes, vhumpa
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard: network
Fixed In Version: NetworkManager-0.9.9.1-35.git20140326.4dba720.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1142701 (view as bug list) Environment:
Last Closed: 2015-03-05 13:52:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1142701    
Attachments:
Description Flags
journalctl -b -u NetworkManager.service
none
[PATCH] core: don't generate a connection for unmanaged devices none

Description Ondřej Svoboda 2014-09-03 12:14:09 UTC
Created attachment 934065 [details]
journalctl -b -u NetworkManager.service

Description of problem:

VDSM component of oVirt project is used (among many other tasks) to manage and monitor select network devices of a virtualization slave. In particular, to be able to report options of bonding devices it manages, it has to create a randomly named (to prevent clashes) dummy bond on startup to asses default kernel options (and deletes it right away).

As soon as NetworkManager learns of this new bonding device it sets its state to UP. This, however, makes VDSM unable to change bonding mode of the device ("Operation not permitted"), which is crucial for reading default bonding options across modes.

As a workaround, VDSM could ifdown the device but I am seeking a solution in NetworkManager. I hoped that installing NetworkManager-config-server package would prevent NM from managing the bond, but neither of two directives in 00-server.conf, 'no-auto-default' and 'ignore-carrier', apply to this situation.

Is there a way to keep this bond in its DOWN state with NetworkManager running?

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

NetworkManager-0.9.9.1-25.git20140326.4dba720.el7_0.x86_64
NetworkManager-config-server-0.9.9.1-25.git20140326.4dba720.el7_0.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Make sure you have NetworkManager running with 00-server.conf in /etc/NetworkManager/conf.d/
2. echo +do_not_ifup > /sys/class/net/bonding_masters
3. ip link show do_not_ifup

Actual results:

9: do_not_ifup: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT
    link/ether 4a:9f:7f:1e:61:f0 brd ff:ff:ff:ff:ff:ff

Expected results:

9: do_not_ifup: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noqueue state DOWN mode DEFAULT 
    link/ether 4a:9f:7f:1e:61:f0 brd ff:ff:ff:ff:ff:ff

Additional info:

journalctl -b -u NetworkManager.service attached.

Comment 2 Jirka Klimes 2014-09-03 14:05:16 UTC
It should be sufficient to add 'unmanaged-devices' option to keyfile section in NetworkManager.conf.
/etc/NetworkManager.conf

...
[keyfile]
unmanaged-devices=interface-name:do_not_ifup;interface-name:other_iface;

Unfortunately, RHEL7 version of NM misses this commit:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=194b14e39899e8f3a73b1a151ed5384ecbf80149
which will cause that a connection will be created for the interface. And NM will not show the interface as unmanaged. However, the interface will be downed, so this could be good enough for your usecase.

Alternatively, you can add the line into the config file *after* you created the interface, this will cause that NM will properly unmanage the interface.
Yet another way is to create /etc/sysconfig/network-scripts/ifcfg-bla
with this content:
DEVICE=do_not_ifup
NM_CONTROLLED=no
and then call 'nmcli con load /etc/sysconfig/network-scripts/ifcfg-bla'

Note:
We consider adding an API for unmanaging interfaces, see bug 1114685. However, the main goal is to make NetworkManager to be non-disruptive, so that one doesn't have to care about whether an interface is managed or not.

Comment 3 Antoni Segura Puimedon 2014-09-03 21:24:46 UTC
Hi Jirka,

When you say 'the interface will be downed' do you mean that it will be taken back down after NM takes it up? If that is the case, we need a way to work around (or better yet, prevent) the iff_up.

Comment 4 Ondřej Svoboda 2014-09-03 23:16:52 UTC
Jirka, thanks for your answer :-)

(In reply to Jirka Klimes from comment #2)
> It should be sufficient to add 'unmanaged-devices' option to keyfile section
> in NetworkManager.conf.
> /etc/NetworkManager.conf
> 
> ...
> [keyfile]
> unmanaged-devices=interface-name:do_not_ifup;interface-name:other_iface;
> 
> Unfortunately, RHEL7 version of NM misses this commit:
> http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/
> ?id=194b14e39899e8f3a73b1a151ed5384ecbf80149
> which will cause that a connection will be created for the interface. And NM
> will not show the interface as unmanaged. However, the interface will be
> downed, so this could be good enough for your usecase.

If this option accepts a glob like bond* and can be added to /etc/NetworkManager/conf.d/00-server.conf I consider this a good solution for my problem :-) I would only have to name the dummy bond accordingly (append the random part to 'bond' prefix).

> Alternatively, you can add the line into the config file *after* you created
> the interface, this will cause that NM will properly unmanage the interface.

I'd rather have NM completely ignore the bond.

> Yet another way is to create /etc/sysconfig/network-scripts/ifcfg-bla
> with this content:
> DEVICE=do_not_ifup
> NM_CONTROLLED=no
> and then call 'nmcli con load /etc/sysconfig/network-scripts/ifcfg-bla'

This is also a good workaround. If only NM watched the directory and modified the connection automatically :-)

> Note:
> We consider adding an API for unmanaging interfaces, see bug 1114685.
> However, the main goal is to make NetworkManager to be non-disruptive, so
> that one doesn't have to care about whether an interface is managed or not.

The second approach hints that a proper API is welcome. Taking manual control should be possible, at least for troubleshooting. But this comment belongs to the linked bug, I guess.

Comment 5 Jirka Klimes 2014-09-08 16:31:23 UTC
(In reply to Antoni Segura Puimedon from comment #3)
> Hi Jirka,
> 
> When you say 'the interface will be downed' do you mean that it will be
> taken back down after NM takes it up? If that is the case, we need a way to
> work around (or better yet, prevent) the iff_up.

In my test the interface stays down, so it should be OK.
Anyway, NM will not show the interface as unmanaged. So we should include the commit I pointed out in comment #2 into RHEL7:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=194b14e39899e8f3a73b1a151ed5384ecbf80149

I would focus this bug on that.

Comment 6 Jirka Klimes 2014-09-08 16:34:02 UTC
Created attachment 935415 [details]
[PATCH] core: don't generate a connection for unmanaged devices

Rebase of the upstream patch to RHEL7 code.

Comment 9 Dan Winship 2014-09-11 12:30:14 UTC
patch looks right

Comment 14 errata-xmlrpc 2015-03-05 13:52:55 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://rhn.redhat.com/errata/RHBA-2015-0311.html