[node-patches] Change in ovirt-node[node-3.0]: Hide _flush() output on the remote_storage page
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Wed Mar 5 11:27:18 UTC 2014
Hello Ryan Barry,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/25398
to review the following change.
Change subject: Hide _flush() output on the remote_storage page
......................................................................
Hide _flush() output 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>
Signed-off-by: Fabian Deutsch <fabiand at redhat.com>
---
M src/ovirt/node/utils/system.py
1 file changed, 13 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/98/25398/1
diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index c5d288d..60832f4 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -605,27 +605,30 @@
pipe() is used to capture the output of the calls
"""
- process.pipe(["partprobe"] + [x for x in glob.glob("/dev/mapper/*")
- if not re.match(r'.*\/control$', x)],
- stderr=process.STDOUT, check=False)
- process.pipe(["udevadm", "settle"],
- stderr=process.STDOUT, check=False)
+ # Don't litter the screen with output, so get a handle to /dev/null
+ with open(os.devnull, 'wb') as DEVNULL:
+ process.call(["partprobe"] + [x for x in glob.glob("/dev/mapper/*")
+ if not re.match(r'.*\/control$', x)],
+ stdout=DEVNULL, stderr=DEVNULL)
+ process.call(["udevadm", "settle"], stdout=DEVNULL, stderr=DEVNULL)
@staticmethod
def by_label(label):
"""Determines whether a filesystem with a given label is present on
this system
"""
+ fs = None
try:
Filesystem._flush()
- device = process.check_output(["blkid", "-c", "/dev/null",
- "-L", label])
+ with open(os.devnull, 'wb') as DEVNULL:
+ device = process.check_output(["blkid", "-c", "/dev/null",
+ "-L", label], stderr=DEVNULL)
- return Filesystem(label, device)
+ fs = Filesystem(label, device)
except process.CalledProcessError as e:
- self.logger.exception("Failed to resolve disks: %s" % e.cmd)
- return None
+ LOGGER.debug("Failed to resolve disks: %s" % e.cmd, exc_info=True)
+ return fs
def _tokens(self):
tokens = process.check_output(["blkid", "-o", "export", self.device])
--
To view, visit http://gerrit.ovirt.org/25398
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3f260be7988ae5e9a52243f34e762a264e725b6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: node-3.0
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
Gerrit-Reviewer: Ryan Barry <rbarry at redhat.com>
More information about the node-patches
mailing list