Change in vdsm[master]: repopolot: Remove duplicate command end detection

nsoffer at redhat.com nsoffer at redhat.com
Sat Feb 27 16:44:47 UTC 2016


Nir Soffer has uploaded a new change for review.

Change subject: repopolot: Remove duplicate command end detection
......................................................................

repopolot: Remove duplicate command end detection

Extract is_command_end(log) function replacing duplicate code in command
handlers.

Change-Id: I8088a98b173bfe7d805fd8e0521784a0c8492e85
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M contrib/repoplot
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/54113/1

diff --git a/contrib/repoplot b/contrib/repoplot
index 4dd083f..e91ddd4 100755
--- a/contrib/repoplot
+++ b/contrib/repoplot
@@ -262,7 +262,7 @@
     """
     Add commands start and stop events from execCmd calls
     """
-    if "SUCCESS:" in log.text or "ERROR:" in log.text:
+    if is_command_end(log):
         commands[log.thread].end(log.timestamp)
     else:
         commands[log.thread].start(log.timestamp)
@@ -284,12 +284,16 @@
     """
     Add qemu-img commands start or stop events (pre 4.0).
     """
-    if "SUCCESS:" in log.text or "ERROR:" in log.text:
+    if is_command_end(log):
         commands[log.thread].end(log.timestamp)
     elif "/usr/bin/qemu-img convert " in log.text:
         commands[log.thread].start(log.timestamp)
 
 
+def is_command_end(log):
+    return log.text.startswith(("SUCCESS:", "ERROR:"))
+
+
 def parse_log(line):
     # thread::loglevel::timestamp::module::lineno::logger::(func) text
     fields = line.split("::", 6)


-- 
To view, visit https://gerrit.ovirt.org/54113
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8088a98b173bfe7d805fd8e0521784a0c8492e85
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list