Change in vdsm[master]: storage.misc: use the new util.isOvirtNode()

danken at redhat.com danken at redhat.com
Sat Nov 2 15:00:01 UTC 2013


Dan Kenigsberg has uploaded a new change for review.

Change subject: storage.misc: use the new util.isOvirtNode()
......................................................................

storage.misc: use the new util.isOvirtNode()

Change-Id: I6da5c94b5a8c11eace4813530570380c651e6d88
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
---
M vdsm/storage/misc.py
1 file changed, 5 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/20809/1

diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index fc13a9c..7b8d8ea 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -62,7 +62,6 @@
 DATASYNCFLAG = "fdatasync"
 STR_UUID_SIZE = 36
 UUID_HYPHENS = [8, 13, 18, 23]
-OVIRT_NODE = False
 MEGA = 1 << 20
 UNLIMITED_THREADS = -1
 
@@ -508,7 +507,7 @@
     for key in keys:
         oldName = os.path.join(directory, fd[key]['old'])
         newName = os.path.join(directory, fd[key]['new'])
-        if OVIRT_NODE and persist and not cp:
+        if utils.isOvirtNode() and persist and not cp:
             try:
                 execCmd([constants.EXT_UNPERSIST, oldName], logErr=False,
                         sudo=True)
@@ -519,7 +518,8 @@
         try:
             if cp:
                 execCmd([constants.EXT_CP, oldName, newName], sudo=True)
-                if OVIRT_NODE and persist and not os.path.exists(newName):
+                if (utils.isOvirtNode() and persist and
+                        not os.path.exists(newName)):
                     execCmd([constants.EXT_PERSIST, newName], logErr=False,
                             sudo=True)
 
@@ -527,7 +527,7 @@
                 os.rename(oldName, newName)
         except:
             pass
-        if OVIRT_NODE and persist and not cp:
+        if utils.isOvirtNode() and persist and not cp:
             try:
                 execCmd([constants.EXT_PERSIST, newName], logErr=False,
                         sudo=True)
@@ -536,7 +536,7 @@
 
 
 def persistFile(name):
-    if OVIRT_NODE:
+    if utils.isOvirtNode():
         execCmd([constants.EXT_PERSIST, name], sudo=True)
 
 
@@ -1109,13 +1109,6 @@
         return True
     except (UnicodeDecodeError, UnicodeEncodeError):
         return False
-
-# Upon import determine if we are running on ovirt
-try:
-    OVIRT_NODE = os.path.exists('/etc/rhev-hypervisor-release') or \
-        not len(glob.glob('/etc/ovirt-node-*-release')) == 0
-except:
-    pass
 
 
 def walk(top, topdown=True, onerror=None, followlinks=False, blacklist=[]):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6da5c94b5a8c11eace4813530570380c651e6d88
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list