[node-patches] Change in ovirt-node[master]: Hide output from partprobe and udev on the remote_storage page

rbarry at redhat.com rbarry at redhat.com
Fri Feb 7 14:41:44 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Hide output from partprobe and udev on the remote_storage page
......................................................................

Hide output from partprobe and udev on the remote_storage page

Redirect stderr and stdout to /dev/null so the screen doesn't get
cluttered.

Change-Id: Ie3f260be7988ae5e9a52243f34e762a264e725b6
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/utils/system.py
1 file changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/03/24203/1

diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index d8861d7..b852173 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -529,12 +529,21 @@
         """Determines whether a filesystem with a given label is present on
         this system
         """
+
+        # Don't litter the screen with output, so get a handle to /dev/null
+
+        try:
+            from subprocess import DEVNULL
+        except ImportError:
+            DEVNULL = open(os.devnull, 'wb')
         process.call(["partprobe"] + [x for x in glob.glob("/dev/mapper/*")
-                                      if not re.match(r'.*\/control$', x)])
-        process.call(["udevadm", "settle"])
+                                      if not re.match(r'.*\/control$', x)],
+                     stdout=DEVNULL, stderr=DEVNULL)
+        process.call(["udevadm", "settle"], stdout=DEVNULL, stderr=DEVNULL)
         try:
             process.check_call(["/sbin/blkid", "-c", "/dev/null", "-l", "-o",
-                                "device", "-t", 'LABEL="%s"' % label])
+                                "device", "-t", 'LABEL="%s"' % label],
+                               stdout=DEVNULL, stderr=DEVNULL)
 
             return True
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3f260be7988ae5e9a52243f34e762a264e725b6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list