Bug 624850

Summary: system-config-network-cmd handles IP aliases poorly
Product: Red Hat Enterprise Linux 5 Reporter: Paul Donohue <redhatbugs>
Component: system-config-networkAssignee: Harald Hoyer <harald>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: low    
Version: 5.5CC: briang, syeghiay, usurse
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 847282 (view as bug list) Environment:
Last Closed: 2012-12-17 15:24:54 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 847282    

Description Paul Donohue 2010-08-17 18:23:58 EDT
Let's say I want to create a network profile called 'default' with the following:
eth1   -> 10.10.10.10
eth1:0 -> 10.10.10.11
eth1:1 -> 10.10.10.12

And a second network profile called 'testing' with the following:
eth1   -> 10.10.10.10
eth1:0 -> 10.10.10.11
eth1:1 -> 10.10.10.34

If I create a single 'ifcfg-eth1' file for the parent device and use it for both profiles, then when switching between the profiles using system-config-network-cmd, the eth1:1 IP will not change.

One work-around is to create two identical files, 'ifcfg-eth1_default' and 'ifcfg-eth1_testing', and use those files for the two profiles.  However, this causes system-config-network-cmd to bring down both eth1 and eth1:0 while changing the profiles, which in my case is unacceptable.

A better solution is to modify /usr/share/system-config-network/netconf-cmd.py, and change "actdev.find(device.Device)" on lines 335 and 348 to "actdev.find(device.getDeviceAlias())".  With this change, system-config-network-cmd will only bring down/up those IP aliases that actually changed between profiles.

I hope you'll consider incorporating this change.
Comment 1 Paul Donohue 2010-08-17 19:06:57 EDT
In addition to the above changes, you'll also need to change "device.OnBoot:" to "(device.OnBoot or device.OnParent):" on line 349, or else the new aliases won't come up unless they have "ONBOOT=yes" listed in the alias config file.
Comment 2 Paul Donohue 2010-08-17 19:27:53 EDT
Or perhaps change "device.OnBoot:" to "(device.OnBoot or (actdev.find(device.Device) and device.OnParent)):" on line 349, so the aliases will be brought up by system-config-network-cmd if the parent device hasn't changed, but will be brought automatically by the parent device otherwise.

In patch form:
--- netconf-cmd.py.orig 2009-07-14 14:27:51.000000000 -0400
+++ netconf-cmd.py      2010-08-17 19:26:11.000000000 -0400
@@ -332,7 +332,7 @@
                             break
                     for device in getDeviceList():
                         if device.DeviceId not in aprof.ActiveDevices:
-                            if actdev.find(device.Device):
+                            if actdev.find(device.getDeviceAlias()):
                                 (ret, msg) = device.deactivate()
                                 if ret:
                                     print msg
@@ -345,8 +345,9 @@
                 aprof = profilelist.getActiveProfile()
                 for device in getDeviceList():
                     if device.DeviceId in aprof.ActiveDevices:
-                        if not actdev.find(device.Device) and \
-                           device.OnBoot:
+                        if not actdev.find(device.getDeviceAlias()) and \
+                           (device.OnBoot or (actdev.find(device.Device) \
+                           and device.OnParent)):
                             (ret, msg) = device.activate()
                             if ret:
                                 print msg
Comment 3 Paul Donohue 2012-08-02 17:50:08 EDT
This issue is still present in RHEL6.  The following patch applies against RHEL6:

--- netconf_cmd.py.orig 2012-08-02 17:40:37.072388765 -0400
+++ netconf_cmd.py      2012-08-02 17:42:35.473511192 -0400
@@ -368,7 +368,7 @@
                             break
                     for device in getDeviceList():
                         if device.DeviceId not in aprof.ActiveDevices:
-                            if actdev.find(device.Device):
+                            if actdev.find(device.getDeviceAlias()):
                                 (ret, msg) = device.deactivate()
                                 if ret:
                                     print msg
@@ -381,8 +381,9 @@
                 aprof = profilelist.getActiveProfile()
                 for device in getDeviceList():
                     if device.DeviceId in aprof.ActiveDevices:
-                        if not actdev.find(device.Device) and \
-                           device.OnBoot:
+                        if not actdev.find(device.getDeviceAlias()) and \
+                           (device.OnBoot or (actdev.find(device.Device) \
+                           and device.OnParent)):
                             (ret, msg) = device.activate()
                             if ret:
                                 print msg

I've been using the previous patch on RHEL5 in a production environment for almost 2 years now.  I've been using the above RHEL6 patch in a production environment for about 6 months.  It works as intended, and I have yet to discover any side-effects.
Comment 5 RHEL Product and Program Management 2012-08-03 04:08:49 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.
Comment 8 Brian Gollaher 2012-12-17 15:24:54 EST
Due to the end of Production Phase 1 of the Red Hat Enterprise Lifecycle for RHEL5, we are closing this RFE.

Please refer to:
https://access.redhat.com/support/policy/updates/errata/