Change in vdsm[master]: ifcfg: use oVirt node's to remove files

asegurap at redhat.com asegurap at redhat.com
Wed Jun 18 08:36:45 UTC 2014


Antoni Segura Puimedon has uploaded a new change for review.

Change subject: ifcfg: use oVirt node's to remove files
......................................................................

ifcfg: use oVirt node's to remove files

Doing this, when flushing the old network configuration, oVirt node
will take care to unmount and unpersist the files, as well as
removing them.

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


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/28879/1

diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index 7a97736..f16db66 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -37,6 +37,11 @@
 from vdsm import utils
 from vdsm.netconfpersistence import RunningConfig
 
+try:
+    from ovirt.node.utils import fs as node_fs
+except ImportError:
+    node_fs = None
+
 from . import Configurator, dhclient, getEthtoolOpts, libvirt
 from ..errors import ConfigNetworkError, ERR_FAILED_IFUP
 from ..models import Nic, Bridge, IpConfig
@@ -270,12 +275,12 @@
 
     @staticmethod
     def _removeFile(filename):
-        """Remove file, umounting ovirt config files if needed."""
-
-        mounts = open('/proc/mounts').read()
-        if ' /config ext3' in mounts and ' %s ext3' % filename in mounts:
-            utils.execCmd([constants.EXT_UMOUNT, '-n', filename])
-        utils.rmFile(filename)
+        """Remove file (directly or using oVirt node's library)"""
+        if node_fs is None:
+            utils.rmFile(filename)
+        else:
+            nodeconfig = node_fs.Config()
+            nodeconfig.delete(filename)
         logging.debug("Removed file %s", filename)
 
     def createLibvirtNetwork(self, network, bridged=True, iface=None,


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

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