Milan Zamazal has uploaded a new change for review.

Change subject: storage: Make _readspeed_regex compatible with more dd outputs
......................................................................

storage: Make _readspeed_regex compatible with more dd outputs

Some versions of dd, e.g. the current one in Debian testing, produce
outputs that don't match the current regexp.  For instance:

  460 bytes copied, 0.000234846 s, 2.0 MB/s

or

  4096 bytes (4.1 kB, 4.0 KiB) copied, 0.00150043 s, 2.7 MB/s

This patch makes _readspeed_regex compatible with those outputs.

Change-Id: I40e94305aa18000f2ba74463d71df552cac2cbf9
Signed-off-by: Milan Zamazal <mzama...@redhat.com>
---
M lib/vdsm/storage/misc.py
M tests/miscTests.py
2 files changed, 6 insertions(+), 1 deletion(-)


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

diff --git a/lib/vdsm/storage/misc.py b/lib/vdsm/storage/misc.py
index fab8dd7..3876135 100644
--- a/lib/vdsm/storage/misc.py
+++ b/lib/vdsm/storage/misc.py
@@ -193,7 +193,8 @@
     return str(ctime)
 
 _readspeed_regex = re.compile(
-    "(?P<bytes>\d+) bytes? \([\de\-.]+ [kMGT]*B\) copied, "
+    "(?P<bytes>\d+) bytes?"
+    "( \([\de\-.]+ [kMGT]*B(, [\de\-.]+ [KMGTi]*B)?\))? copied, "
     "(?P<seconds>[\de\-.]+) s, "
     "([\de\-.]+|Infinity) [kMGT]*B/s"
 )
diff --git a/tests/miscTests.py b/tests/miscTests.py
index 8359833..9b563d8 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -858,6 +858,10 @@
          "512", "1"),
         ("524288 bytes (512e3 B) copied, 1 s, 512e3 B/s",
          "524288", "1"),
+        ("4096 bytes (4.1 kB, 4.0 KiB) copied, 1 s, 4 kB/s",
+         "4096", "1"),
+        ("460 bytes copied, 1 s, 460 B/s",
+         "460", "1"),
         ("517 bytes (517 B) copied, 0 s, Infinity B/s",
          "517", "0")
     ])


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40e94305aa18000f2ba74463d71df552cac2cbf9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzama...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to