Change in vdsm[ovirt-3.5]: ifcfg: make default route network be started by sysV

asegurap at redhat.com asegurap at redhat.com
Thu Jun 26 09:56:36 UTC 2014


Antoni Segura Puimedon has uploaded a new change for review.

Change subject: ifcfg: make default route network be started by sysV
......................................................................

ifcfg: make default route network be started by sysV

With the change to unified persistence, the networks defined by vdsm
are only started and restored on boot by vdsmd itself. The issue
with this is that if vdsmd fails to start for not networking reasons
it may impede remote access to the machine.

This patch is a fix for oVirt 3.5 only (future versions will have
separate network and vdsm initializations) that solves the issue by
making all the interfaces that are needed for the network that is
defined to carry the default route (typically the management network)
have ONBOOT=yes. That setting makes the initscripts network service
configure the network itself. So for the default route network, the
boot process is going to be:

    a) sysV or systemd start network.service,
    b) network.service goes over all the ifcfg files and ifups those
       with ONBOOT=yes
    c) vdsmd start will call vdsm-network-restore-config which will:
      + flush ifcfg files
      + call setupNetworks to restore all the defined networks.

It's easy to see that if (c) does not happen we will be left with
only the default route network, so remote access will still be
possible.

Change-Id: Idd462b0c3c8e9a86434166618eddde69788fd604
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M vdsm/network/configurators/ifcfg.py
M vdsm/network/models.py
2 files changed, 13 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/29246/1

diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index 09b5ac8..b61f693 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -561,8 +561,11 @@
         if not mtu:
             mtu = device.mtu
         cfg = ['DEVICE=%s' % pipes.quote(device.name),
-               'ONBOOT=%s' % 'no' if self.unifiedPersistence else 'yes',
                'NM_CONTROLLED=no' % device]
+        if not self.unifiedPersistence or device._serving_defroute:
+            cfg.append('ONBOOT=yes')
+        else:
+            cfg.append('ONBOOT=no')
         if device.bridge:
             cfg.append('BRIDGE=%s' % device.bridge.name)
         if ipconfig.ipaddr:
diff --git a/vdsm/network/models.py b/vdsm/network/models.py
index 34e4a02..ea56eff 100644
--- a/vdsm/network/models.py
+++ b/vdsm/network/models.py
@@ -71,6 +71,15 @@
             return self.master
         return None
 
+    @property
+    def _serving_defroute(self):
+        device = self
+        while device:
+            if device.ipConfig.defaultRoute:
+                return True
+            device = self.master
+        return False
+
 
 class Nic(NetDevice):
     def __init__(self, name, configurator, ipconfig=None, mtu=None,


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

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


More information about the vdsm-patches mailing list