Change in vdsm[master]: utils: must unpersist files for remove

dougsland at redhat.com dougsland at redhat.com
Thu Jun 5 08:32:43 UTC 2014


Hello mooli tayer,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/28383

to review the following change.

Change subject: utils: must unpersist files for remove
......................................................................

utils: must unpersist files for remove

In rmFile() we must unpersist the file that will be removed
before removing it if the OS is oVirt Node.

Change-Id: I0507fcbc5338aaf76fecb08ca4e6d84138347ec9
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1104035
Signed-off-by: Mooli Tayer <mtayer at redhat.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/28383/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index edb715e..836cd3d 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -57,6 +57,12 @@
 from .config import config
 from . import constants
 
+try:
+    from ovirt.node.utils.fs import Config
+except ImportError:
+    # We should continue on non ovirt-node
+    pass
+
 # Buffsize is 1K because I tested it on some use cases and 1K was fastest. If
 # you find this number to be a bottleneck in any way you are welcome to change
 # it
@@ -121,6 +127,9 @@
 
     If the file doesn't exist it's assumed that it was already removed.
     """
+    if isOvirtNode():
+        Config().unpersist(fileToRemove)
+
     try:
         os.unlink(fileToRemove)
     except OSError as e:
@@ -1105,6 +1114,14 @@
     sys.exit(-3)
 
 
+ at memoized
+def isOvirtNode():
+    return (
+        os.path.exists('/etc/rhev-hypervisor-release') or
+        glob.glob('/etc/ovirt-node-*-release')
+    )
+
+
 # Copied from
 # http://docs.python.org/2.6/library/itertools.html?highlight=grouper#recipes
 def grouper(iterable, n, fillvalue=None):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0507fcbc5338aaf76fecb08ca4e6d84138347ec9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>
Gerrit-Reviewer: mooli tayer <mtayer at redhat.com>


More information about the vdsm-patches mailing list