From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has uploaded a new change for review.
Change subject: move exec_sync_bytes to common.cmdutils
......................................................................
move exec_sync_bytes to common.cmdutils
exec_sync_bytes is useful not only in the network subpackage, so it
needs to reside under vdsm.common.
Change-Id: Idca5b123a4ce6ef5ebaff8084d788e2acd47c2be
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/common/cmdutils.py
M lib/vdsm/network/cmd.py
2 files changed, 16 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/79693/1
diff --git a/lib/vdsm/common/cmdutils.py b/lib/vdsm/common/cmdutils.py
index 85a4ae0..26e08a7 100644
--- a/lib/vdsm/common/cmdutils.py
+++ b/lib/vdsm/common/cmdutils.py
@@ -22,6 +22,8 @@
import os
import re
+from vdsm.common.compat import CPopen as Popen
+
SYSTEMD_RUN = "/usr/bin/systemd-run"
@@ -106,3 +108,16 @@
CPU = 'CPU'
Memory = 'Memory'
BlockIO = 'BlockIO'
+
+
+def exec_sync_bytes(cmds):
+ logging.debug(cmdutils.command_log_line(cmds))
+
+ p = Popen(
+ cmds, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+ out, err = p.communicate()
+
+ logging.debug(cmdutils.retcode_log_line(p.returncode, err=err))
+
+ return p.returncode, out, err
diff --git a/lib/vdsm/network/cmd.py b/lib/vdsm/network/cmd.py
index f6d9b73..bf5d537 100644
--- a/lib/vdsm/network/cmd.py
+++ b/lib/vdsm/network/cmd.py
@@ -23,8 +23,7 @@
import uuid
from vdsm.common import cmdutils
-from vdsm.common.cmdutils import systemd_run
-from vdsm.common.compat import CPopen as Popen
+from vdsm.common.cmdutils import systemd_run, exec_sync_bytes
from vdsm.network import py2to3
@@ -50,16 +49,3 @@
cmds = systemd_run(cmds, scope=True, unit=unit, slice=slice_name)
return exec_sync(cmds)
-
-
-def exec_sync_bytes(cmds):
- logging.debug(cmdutils.command_log_line(cmds))
-
- p = Popen(
- cmds, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-
- out, err = p.communicate()
-
- logging.debug(cmdutils.retcode_log_line(p.returncode, err=err))
-
- return p.returncode, out, err
--
To view, visit
https://gerrit.ovirt.org/79693
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idca5b123a4ce6ef5ebaff8084d788e2acd47c2be
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>