Change in vdsm[master]: ifcfg: Put hotplug=no for virtual devices

asegurap at redhat.com asegurap at redhat.com
Wed May 21 15:25:16 UTC 2014


Antoni Segura Puimedon has uploaded a new change for review.

Change subject: ifcfg: Put hotplug=no for virtual devices
......................................................................

ifcfg: Put hotplug=no for virtual devices

In el6 systems, udev can trigger an ifup call when a device is
created. The issue with the triggering is that when we create a
virtual device, e.g. a vlan, we do so via ifup, so what will
happen is:

we write ethX.Y
initscripts creates the
  vlan device with id Y
  on top of ethX.                      udev detects the new device
        | Process 1                              | Process 2
initscripts finished doing             udev calls initscripts' ifup
ifup, possibly calling dhclient            for the new vlan device
                                       initscripts possibly calls
                                           dhclient

The issue is that the two processes can do the dhclient in whichever
order and one dhclient will prevent the other from succeeding. Only
one ifup should be called for each device, so we need hotplug=no to
prevent Process 2 from succeeding in its ifup.

Our current usage of ifcfg files does not set hotplug=no
so that when the user replaces a physical card by hot-unplugging
and hot-plugging there will be an auto configuration. This behavior
is maintained by the fact that we only set hotplug=no for those
devices for which we control the whole life cycle, i.e., vlans,
bonds and bridges.

Bug-Url: https://bugzilla.redhat.com/1097818
Change-Id: I6a60bb8d461572855c951fff8c991e34e0feb332
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M vdsm/network/configurators/ifcfg.py
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/27980/1

diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index e8c12de..b3f0774 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -607,6 +607,7 @@
     def addBridge(self, bridge, **opts):
         """ Create ifcfg-* file with proper fields for bridge """
         conf = 'TYPE=Bridge\nDELAY=0\n'
+        opts['hotplug'] = 'no'  # So that udev doesn't trigger an ifup
         if bridge.stp is not None:
             conf += 'STP=%s\n' % ('on' if bridge.stp else 'off')
         ipconfig = bridge.ipConfig
@@ -620,6 +621,7 @@
     def addVlan(self, vlan, **opts):
         """ Create ifcfg-* file with proper fields for VLAN """
         conf = 'VLAN=yes\n'
+        opts['hotplug'] = 'no'  # So that udev doesn't trigger an ifup
         if vlan.bridge:
             conf += 'BRIDGE=%s\n' % pipes.quote(vlan.bridge.name)
         ipconfig = vlan.ipConfig
@@ -630,6 +632,7 @@
     def addBonding(self, bond, **opts):
         """ Create ifcfg-* file with proper fields for bond """
         conf = 'BONDING_OPTS=%s\n' % pipes.quote(bond.options or '')
+        opts['hotplug'] = 'no'  # So that udev doesn't trigger an ifup
         if bond.bridge:
             conf += 'BRIDGE=%s\n' % pipes.quote(bond.bridge.name)
 


-- 
To view, visit http://gerrit.ovirt.org/27980
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a60bb8d461572855c951fff8c991e34e0feb332
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>


More information about the vdsm-patches mailing list