Change in vdsm[master]: ifcfg: set onboot=no when persistence is 'unified'

asegurap at redhat.com asegurap at redhat.com
Fri May 9 13:29:12 UTC 2014


Antoni Segura Puimedon has uploaded a new change for review.

Change subject: ifcfg: set onboot=no when persistence is 'unified'
......................................................................

ifcfg: set onboot=no when persistence is 'unified'

Up until now the ifcfg network configurator had been setting up
onboot=yes so that when starting up the computer, network.service
would bring up the vdsm networks and devices. This, however, is
counter productive when using the 'unified' net_persistence setting
as the boot up process would:
1. network.service would create the devices and networks
2. vdsm-restore-net-config would remove all the networks
3. vdsm-restore-net-config would flush the ifcfg files
4. vdsm-restore-net-config would bring up the networks and devices
   again

In the case of dhcp, that would imply a lot of duplicated address
assignment time. Thus, this patch eliminates the step one from
above.

Change-Id: I1ad8bbdcaeb1790b7955f3a407758ee41c68befa
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M vdsm/network/configurators/ifcfg.py
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/27541/1

diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index 855e5a1..5a9c4d9 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -51,15 +51,16 @@
 class Ifcfg(Configurator):
     # TODO: Do all the configApplier interaction from here.
     def __init__(self, inRollback=False):
-        super(Ifcfg, self).__init__(ConfigWriter(), inRollback)
         self.unifiedPersistence = \
             config.get('vars', 'net_persistence') == 'unified'
+        super(Ifcfg, self).__init__(ConfigWriter(self.unifiedPersistence),
+                                    inRollback)
         if self.unifiedPersistence:
             self.runningConfig = RunningConfig()
 
     def begin(self):
         if self.configApplier is None:
-            self.configApplier = ConfigWriter()
+            self.configApplier = ConfigWriter(self.unifiedPersistence)
         if self.unifiedPersistence and self.runningConfig is None:
             self.runningConfig = RunningConfig()
 
@@ -258,9 +259,10 @@
         dsaversion.raw_version_revision
     DELETED_HEADER = '# original file did not exist'
 
-    def __init__(self):
+    def __init__(self, unifiedPersistence=False):
         self._backups = {}
         self._networksBackups = {}
+        self.unifiedPersistence = unifiedPersistence
 
     def flush(self):
         """Removes all owned ifcfg, route and rule files."""
@@ -557,7 +559,8 @@
     def _createConfFile(self, conf, name, ipconfig, mtu=None, **kwargs):
         """ Create ifcfg-* file with proper fields per device """
 
-        cfg = """DEVICE=%s\nONBOOT=yes\n""" % pipes.quote(name)
+        cfg = """DEVICE=%s\nONBOOT=%s\n""" % (
+            pipes.quote(name), 'no' if self.unifiedPersistence else 'yes')
         cfg += conf
         if ipconfig.ipaddr:
             cfg = cfg + 'IPADDR=%s\n' % pipes.quote(ipconfig.ipaddr)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ad8bbdcaeb1790b7955f3a407758ee41c68befa
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