Change in vdsm[ovirt-3.5]: net: always persist ifcfg files.

ibarkan at redhat.com ibarkan at redhat.com
Mon Aug 17 13:06:43 UTC 2015


Ido Barkan has uploaded a new change for review.

Change subject: net: always persist ifcfg files.
......................................................................

net: always persist ifcfg files.

Currently the persistence of ifcfg files is only done during
setSafeNetworkConfig. But, if the user somehow opts out of this (by
unticking this option in engine, or if setupNetwork is called out of
this flow (e.g. vdsm-restore-net-config) then vdsm unpersists the
ifcfg files. If then the host reboots without persisting the
unpersisted ifcfg files, those files are gone during boot since they
are not part of the original file system.

Change-Id: I02ae28c345111309536e4af2bd6a09799f38b82f
Signed-off-by: Ido Barkan <ibarkan at redhat.com>
---
M vdsm/network/configurators/ifcfg.py
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/44926/1

diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index c3f9893..793c42d 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -481,15 +481,12 @@
         self._backup(fileName)
         configuration = self.CONFFILE_HEADER + '\n' + configuration
 
-        # make sure that ifcfg files are never persisted by the node
-        if self.unifiedPersistence and utils.isOvirtNode():
-            node_fs.Config().unpersist(fileName)
-
         logging.debug('Writing to file %s configuration:\n%s', fileName,
                       configuration)
         with open(fileName, 'w') as confFile:
             confFile.write(configuration)
         os.chmod(fileName, 0o664)
+
         try:
             # filname can be of 'unicode' type. restorecon calls into a C API
             # that needs a char *. Thus, it is necessary to encode unicode to
@@ -499,6 +496,10 @@
             logging.debug('ignoring restorecon error in case '
                           'SElinux is disabled', exc_info=True)
 
+        # make sure that ifcfg files are always persisted by the node
+        if self.unifiedPersistence and utils.isOvirtNode():
+            node_fs.Config().persist(fileName)
+
     @staticmethod
     def _toIfcfgFormat(defaultRoute):
         if defaultRoute is None:


-- 
To view, visit https://gerrit.ovirt.org/44926
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02ae28c345111309536e4af2bd6a09799f38b82f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Ido Barkan <ibarkan at redhat.com>


More information about the vdsm-patches mailing list