Dan Kenigsberg has posted comments on this change.
Change subject: utils: Faster version of list2cmdline ......................................................................
Patch Set 1:
(2 comments)
http://gerrit.ovirt.org/#/c/27548/1/lib/vdsm/utils.py File lib/vdsm/utils.py:
Line 656: parts = [] Line 657: for arg in seq: Line 658: if "'" in arg: Line 659: arg = arg.replace("'", "'") Line 660: if ' ' in arg:
I assume that quoting with single quote is the simplest and safest way, so
doh, my mixup. Line 661: arg = "'" + arg + "'" Line 662: parts.append(arg) Line 663: return ' '.join(parts) Line 664:
Line 699: if not printable: Line 700: printable = command Line 701: Line 702: cmdline = repr(list2cmdline(printable)) Line 703: execCmdLogger.debug("%s (cwd %s)", cmdline, cwd)
How %r would be less expensive then %s?
with %r, repr() would not be called at all (if log level is higher then DEBUG. Line 704: Line 705: p = CPopen(command, close_fds=True, cwd=cwd, env=env, Line 706: deathSignal=deathSignal, childUmask=childUmask) Line 707: p = AsyncProc(p)