From Dan Kenigsberg <[email protected]>: Dan Kenigsberg has uploaded a new change for review.
Change subject: drop execCmd(raw) ...................................................................... drop execCmd(raw) The `raw` argument was ill-conceived, as it modified the type of the output of execCmd. Nowadays we use only raw=True, so we can safely drop it. Change-Id: I2ab6d9dca564da2dd61923888fad0be94afee8c9 Signed-off-by: Dan Kenigsberg <[email protected]> --- M lib/vdsm/commands.py M lib/vdsm/gluster/gfapi.py M lib/vdsm/hooks.py M lib/vdsm/host/__init__.py M lib/vdsm/mkimage.py M lib/vdsm/numa.py M lib/vdsm/storage/clusterlock.py M lib/vdsm/storage/fuser.py M lib/vdsm/storage/mailbox.py M lib/vdsm/storage/misc.py M lib/vdsm/storage/multipath.py M lib/vdsm/storage/qemuimg.py M lib/vdsm/supervdsm_api/containers.py M lib/vdsm/tool/configurators/certificates.py M lib/vdsm/tool/configurators/lvm.py M lib/vdsm/tool/configurators/sanlock.py M lib/vdsm/udevadm.py M lib/vdsm/v2v.py M lib/vdsm/virt/containers/command.py M tests/cmdutils_test.py M tests/commands_test.py M tests/containers/conttestlib.py M tests/loopback.py M tests/mkimage_test.py M tests/storage/mount_test.py M tests/storage/storagetestlib.py M tests/v2v_test.py M vdsm_hooks/hostusb/after_vm_destroy.py M vdsm_hooks/hostusb/before_vm_start.py M vdsm_hooks/localdisk/after_disk_prepare M vdsm_hooks/localdisk/localdisk-helper M vdsm_hooks/openstacknet/openstacknet_utils.py M vdsm_hooks/promisc/after_vm_start.py M vdsm_hooks/promisc/before_vm_destroy.py M vdsm_hooks/scratchpad/before_vm_start.py 35 files changed, 53 insertions(+), 61 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/80214/1 diff --git a/lib/vdsm/commands.py b/lib/vdsm/commands.py index 2041b30..438e839 100644 --- a/lib/vdsm/commands.py +++ b/lib/vdsm/commands.py @@ -42,7 +42,7 @@ BUFFSIZE = 1024 -def execCmd(command, sudo=False, cwd=None, data=None, raw=False, +def execCmd(command, sudo=False, cwd=None, data=None, printable=None, env=None, sync=True, nice=None, ioclass=None, ioclassdata=None, setsid=False, execCmdLogger=logging.root, deathSignal=None, resetCpuAffinity=True): @@ -92,10 +92,6 @@ out = "" execCmdLogger.debug(retcode_log_line(p.returncode, err=err)) - - if not raw: - out = out.splitlines(False) - err = err.splitlines(False) return p.returncode, out, err diff --git a/lib/vdsm/gluster/gfapi.py b/lib/vdsm/gluster/gfapi.py index dc455be..00eaf19 100644 --- a/lib/vdsm/gluster/gfapi.py +++ b/lib/vdsm/gluster/gfapi.py @@ -227,7 +227,7 @@ env['PYTHONPATH'] = ":".join(map(os.path.abspath, env['PYTHONPATH'].split(":"))) - rc, out, err = commands.execCmd(command, raw=True, env=env) + rc, out, err = commands.execCmd(command, env=env) if rc != 0: raise ge.GlfsStatvfsException(rc, [out], [err]) res = json.loads(out) @@ -258,7 +258,7 @@ env['PYTHONPATH'] = ":".join(map(os.path.abspath, env['PYTHONPATH'].split(":"))) - rc, out, err = commands.execCmd(command, raw=True, env=env) + rc, out, err = commands.execCmd(command, env=env) if rc != 0: raise ge.GlusterVolumeEmptyCheckFailedException(rc, [out], [err]) return out.upper() == "TRUE" diff --git a/lib/vdsm/hooks.py b/lib/vdsm/hooks.py index f7e9fdf..5d5e4d1 100644 --- a/lib/vdsm/hooks.py +++ b/lib/vdsm/hooks.py @@ -104,7 +104,7 @@ errorSeen = False for s in scripts: - rc, out, err = commands.execCmd([s], raw=True, + rc, out, err = commands.execCmd([s], env=scriptenv) logging.info(err) if rc != 0: diff --git a/lib/vdsm/host/__init__.py b/lib/vdsm/host/__init__.py index 14e01b8..47f8c0d 100644 --- a/lib/vdsm/host/__init__.py +++ b/lib/vdsm/host/__init__.py @@ -44,7 +44,6 @@ ret, out, err = execCmd([constants.EXT_DMIDECODE, "-s", "system-uuid"], - raw=True, sudo=True) out = '\n'.join(line for line in out.splitlines() if not line.startswith('#')) diff --git a/lib/vdsm/mkimage.py b/lib/vdsm/mkimage.py index a76fca5..c630f24 100644 --- a/lib/vdsm/mkimage.py +++ b/lib/vdsm/mkimage.py @@ -123,7 +123,7 @@ command = [EXT_MKFS_MSDOS, '-C', floppy, '1440'] if volumeName is not None: command.extend(['-n', volumeName]) - rc, out, err = execCmd(command, raw=True) + rc, out, err = execCmd(command) if rc: raise OSError(errno.EIO, "could not create floppy file: " "code %s, out %s\nerr %s" % (rc, out, err)) @@ -158,7 +158,7 @@ fd = os.open(isopath, os.O_CREAT | os.O_RDONLY | os.O_EXCL, mode) os.close(fd) - rc, out, err = execCmd(command, raw=True) + rc, out, err = execCmd(command) if rc: # clean up after ourselves in case of error removeFs(isopath) diff --git a/lib/vdsm/numa.py b/lib/vdsm/numa.py index 6683992..56a9729 100644 --- a/lib/vdsm/numa.py +++ b/lib/vdsm/numa.py @@ -165,7 +165,7 @@ def _run_command(args): cmd = [_SYSCTL.cmd] cmd.extend(args) - rc, out, err = commands.execCmd(cmd, raw=True) + rc, out, err = commands.execCmd(cmd) if rc != 0: raise cmdutils.Error(cmd, rc, out, err) diff --git a/lib/vdsm/storage/clusterlock.py b/lib/vdsm/storage/clusterlock.py index 7f760a2..d63adce 100644 --- a/lib/vdsm/storage/clusterlock.py +++ b/lib/vdsm/storage/clusterlock.py @@ -209,7 +209,7 @@ releaseLockCommand = [freeLockUtil, self._sdUUID] self.log.info("Releasing cluster lock for domain %s" % self._sdUUID) - (rc, out, err) = misc.execCmd(releaseLockCommand, raw=True, + (rc, out, err) = misc.execCmd(releaseLockCommand, cwd=self.lockUtilPath) if rc != 0: # TODO: should raise diff --git a/lib/vdsm/storage/fuser.py b/lib/vdsm/storage/fuser.py index ec4aa48..f8bf013 100644 --- a/lib/vdsm/storage/fuser.py +++ b/lib/vdsm/storage/fuser.py @@ -31,7 +31,7 @@ cmd.append("-m") cmd.append(path) - (rc, out, err) = misc.execCmd(cmd, raw=True) + (rc, out, err) = misc.execCmd(cmd) if rc != 0: return [] diff --git a/lib/vdsm/storage/mailbox.py b/lib/vdsm/storage/mailbox.py index dcf3234..6bd6405 100644 --- a/lib/vdsm/storage/mailbox.py +++ b/lib/vdsm/storage/mailbox.py @@ -271,7 +271,7 @@ def _initMailbox(self): # Sync initial incoming mail state with storage view - (rc, out, err) = _mboxExecCmd(self._inCmd, raw=True) + (rc, out, err) = _mboxExecCmd(self._inCmd) if rc == 0: self._incomingMail = out self._init = True @@ -372,7 +372,7 @@ def _checkForMail(self): # self.log.debug("HSM_MailMonitor - checking for mail") # self.log.debug("Running command: " + str(self._inCmd)) - (rc, in_mail, err) = misc.execCmd(self._inCmd, raw=True) + (rc, in_mail, err) = misc.execCmd(self._inCmd) if rc: raise RuntimeError("_handleResponses.Could not read mailbox - rc " "%s" % rc) @@ -741,7 +741,7 @@ cmd = self._inCmd + ['bs=' + str(self._outMailLen)] # self.log.debug("SPM_MailMonitor - reading incoming mail, " # "command: " + str(cmd)) - (rc, in_mail, err) = misc.execCmd(cmd, raw=True) + (rc, in_mail, err) = misc.execCmd(cmd) if rc: raise IOError(errno.EIO, "_handleRequests._checkForMail - " "Could not read mailbox: %s" % self._inbox) diff --git a/lib/vdsm/storage/misc.py b/lib/vdsm/storage/misc.py index 8472dba..a2715ef 100644 --- a/lib/vdsm/storage/misc.py +++ b/lib/vdsm/storage/misc.py @@ -108,7 +108,7 @@ cmd = [constants.EXT_DD, "iflag=%s" % DIRECTFLAG, "skip=%d" % iooffset, "bs=%d" % iounit, "if=%s" % name, "count=%s" % count] - (rc, out, err) = execCmd(cmd, raw=True) + (rc, out, err) = execCmd(cmd) if rc: raise se.MiscBlockReadException(name, offset, size) if not validateDDBytes(err.splitlines(), iounit * count): diff --git a/lib/vdsm/storage/multipath.py b/lib/vdsm/storage/multipath.py index 2c76398..c5d539c 100644 --- a/lib/vdsm/storage/multipath.py +++ b/lib/vdsm/storage/multipath.py @@ -131,7 +131,7 @@ log.debug("Resizing map %r", name) cmd = [_MULTIPATHD.cmd, "resize", "map", name] with utils.stopwatch("Resized map %r" % name, log=log): - rc, out, err = commands.execCmd(cmd, raw=True, execCmdLogger=log) + rc, out, err = commands.execCmd(cmd, execCmdLogger=log) # multipathd reports some errors using non-zero exit code and stderr # (need to be root), but the command may return 0, and the result is # reported using stdout. diff --git a/lib/vdsm/storage/qemuimg.py b/lib/vdsm/storage/qemuimg.py index fb29888..ad7aa53 100644 --- a/lib/vdsm/storage/qemuimg.py +++ b/lib/vdsm/storage/qemuimg.py @@ -332,7 +332,7 @@ def _run_cmd(cmd, cwd=None): - rc, out, err = commands.execCmd(cmd, raw=True, cwd=cwd) + rc, out, err = commands.execCmd(cmd, cwd=cwd) if rc != 0: raise cmdutils.Error(cmd, rc, out, err) return out diff --git a/lib/vdsm/supervdsm_api/containers.py b/lib/vdsm/supervdsm_api/containers.py index b4dc452..9e7a36e 100644 --- a/lib/vdsm/supervdsm_api/containers.py +++ b/lib/vdsm/supervdsm_api/containers.py @@ -37,7 +37,7 @@ 'network', 'inspect', network, - ], raw=True) + ]) @expose diff --git a/lib/vdsm/tool/configurators/certificates.py b/lib/vdsm/tool/configurators/certificates.py index 6036538..b9b148a 100644 --- a/lib/vdsm/tool/configurators/certificates.py +++ b/lib/vdsm/tool/configurators/certificates.py @@ -43,7 +43,6 @@ pki.KEY_FILE, pki.CERT_FILE, ), - raw=True, ) sys.stdout.write(out) sys.stderr.write(err) diff --git a/lib/vdsm/tool/configurators/lvm.py b/lib/vdsm/tool/configurators/lvm.py index 1ea36e5..ed860ec 100644 --- a/lib/vdsm/tool/configurators/lvm.py +++ b/lib/vdsm/tool/configurators/lvm.py @@ -188,7 +188,7 @@ def _systemctl(*args): cmd = [_SYSTEMCTL.cmd] cmd.extend(args) - rc, out, err = commands.execCmd(cmd, raw=True) + rc, out, err = commands.execCmd(cmd) if rc != 0: raise cmdutils.Error(cmd=cmd, rc=rc, out=out, err=err) return out diff --git a/lib/vdsm/tool/configurators/sanlock.py b/lib/vdsm/tool/configurators/sanlock.py index 959fcc6..1c36d0c 100644 --- a/lib/vdsm/tool/configurators/sanlock.py +++ b/lib/vdsm/tool/configurators/sanlock.py @@ -43,7 +43,6 @@ ','.join(SANLOCK_GROUPS), constants.SANLOCK_USER ), - raw=True, ) sys.stdout.write(out) sys.stderr.write(err) diff --git a/lib/vdsm/udevadm.py b/lib/vdsm/udevadm.py index d8eef47..a1e97d3 100644 --- a/lib/vdsm/udevadm.py +++ b/lib/vdsm/udevadm.py @@ -102,6 +102,6 @@ def _run_command(args): cmd = [_UDEVADM.cmd] cmd.extend(args) - rc, out, err = commands.execCmd(cmd, raw=True) + rc, out, err = commands.execCmd(cmd) if rc != 0: raise cmdutils.Error(cmd, rc, out, err) diff --git a/lib/vdsm/v2v.py b/lib/vdsm/v2v.py index 22f8e33..dc91920 100644 --- a/lib/vdsm/v2v.py +++ b/lib/vdsm/v2v.py @@ -349,7 +349,7 @@ self._ssh_auth_re = re.compile(_SSH_AUTH_RE) def __enter__(self): - rc, out, err = execCmd([_SSH_AGENT.cmd], raw=True) + rc, out, err = execCmd([_SSH_AGENT.cmd]) if rc != 0: raise V2VError('Error init ssh-agent, exit code: %r' ', out: %r, err: %r' % diff --git a/lib/vdsm/virt/containers/command.py b/lib/vdsm/virt/containers/command.py index 3e6f12c..a515cbf 100644 --- a/lib/vdsm/virt/containers/command.py +++ b/lib/vdsm/virt/containers/command.py @@ -57,7 +57,7 @@ '--no-pager', '--no-legend', '%s*' % prefix, - ], raw=True) + ]) ) diff --git a/tests/cmdutils_test.py b/tests/cmdutils_test.py index 2169be8..2df4103 100644 --- a/tests/cmdutils_test.py +++ b/tests/cmdutils_test.py @@ -249,7 +249,7 @@ def test_asyncproc_read(self): p = commands.execCmd(["dd", "if=/dev/zero", "bs=%d" % self.BUFSIZE, "count=%d" % self.COUNT], - sync=False, raw=True) + sync=False) start = monotonic_time() p.blocking = True received = 0 @@ -270,7 +270,7 @@ @slowtest def test_asyncproc_write(self): p = commands.execCmd(["dd", "of=/dev/null", "bs=%d" % self.COUNT], - sync=False, raw=True) + sync=False) start = monotonic_time() total = self.COUNT * self.BUFSIZE sent = 0 diff --git a/tests/commands_test.py b/tests/commands_test.py index 9621b28..dfcaf0e 100644 --- a/tests/commands_test.py +++ b/tests/commands_test.py @@ -142,7 +142,7 @@ def run_dd(self, args): cmd = [constants.EXT_DD] cmd.extend(args) - rc, out, err = commands.execCmd(cmd, raw=True, data=self.data) + rc, out, err = commands.execCmd(cmd, data=self.data) if rc != 0: raise self.failureException("Process failed: rc=%d err=%r" % (rc, err)) diff --git a/tests/containers/conttestlib.py b/tests/containers/conttestlib.py index 702affe..f110c22 100644 --- a/tests/containers/conttestlib.py +++ b/tests/containers/conttestlib.py @@ -144,7 +144,7 @@ 'network', 'inspect', network, - ], raw=True) + ]) @recorded def docker_net_create(self, subnet, gw, nic, network): @@ -161,7 +161,7 @@ self._exes.systemctl.cmd, 'stop', name, - ], raw=True) + ]) @recorded def systemd_run(self, unit_name, cgroup_slice, *args): diff --git a/tests/loopback.py b/tests/loopback.py index 61e4c6b..7ca21aa 100644 --- a/tests/loopback.py +++ b/tests/loopback.py @@ -51,7 +51,7 @@ if self._path is not None: raise AssertionError("Device is attached: %s" % self) cmd = ["losetup", "--find", "--show", self._backing_file] - rc, out, err = commands.execCmd(cmd, raw=True) + rc, out, err = commands.execCmd(cmd) if rc != 0: raise cmdutils.Error(cmd, rc, out, err) self._path = out.strip().decode("ascii") @@ -60,7 +60,7 @@ if self._path is None: raise AssertionError("Device is detached: %s" % self) cmd = ["losetup", "--detach", self._path] - rc, out, err = commands.execCmd(cmd, raw=True) + rc, out, err = commands.execCmd(cmd) if rc != 0: raise cmdutils.Error(cmd, rc, out, err) self._path = None diff --git a/tests/mkimage_test.py b/tests/mkimage_test.py index 75f6e7e..9f7d959 100644 --- a/tests/mkimage_test.py +++ b/tests/mkimage_test.py @@ -144,7 +144,7 @@ return cmd = ['blkid', '-s', 'LABEL', imgPath] try: - (ret, out, err) = execCmd(cmd, raw=True) + (ret, out, err) = execCmd(cmd) except OSError: raise SkipTest("cannot execute blkid") @@ -171,7 +171,7 @@ floppy = mkimage.getFileName("vmId_inject", self.files) command = [EXT_MKFS_MSDOS, '-C', floppy, '1440'] try: - rc, out, err = execCmd(command, raw=True) + rc, out, err = execCmd(command) mkimage.injectFilesToFs(floppy, self.files, fstype) @@ -194,7 +194,7 @@ floppy = mkimage.getFileName("vmId_inject", self.files) command = [EXT_MKFS_MSDOS, '-C', floppy, '1440'] try: - rc, out, err = execCmd(command, raw=True) + rc, out, err = execCmd(command) with self.assertRaises(MountError): mkimage.injectFilesToFs(floppy, self.files, 'ext3') diff --git a/tests/storage/mount_test.py b/tests/storage/mount_test.py index 7c3b45c..56427d6 100644 --- a/tests/storage/mount_test.py +++ b/tests/storage/mount_test.py @@ -150,8 +150,7 @@ mountpoint = os.path.join(root_dir, 'mountpoint') with open(backing_image, 'w') as f: os.ftruncate(f.fileno(), 1024 ** 3) - rc, out, err = execCmd(['/sbin/mkfs.ext2', "-F", backing_image], - raw=True) + rc, out, err = execCmd(['/sbin/mkfs.ext2', "-F", backing_image]) if rc != 0: raise RuntimeError("Error creating filesystem: %s" % err) os.symlink(backing_image, link_to_image) diff --git a/tests/storage/storagetestlib.py b/tests/storage/storagetestlib.py index 794c826..e8679cd 100644 --- a/tests/storage/storagetestlib.py +++ b/tests/storage/storagetestlib.py @@ -323,7 +323,7 @@ def qemu_pattern_write(path, format, offset=512, len=1024, pattern=5): write_cmd = 'write -P %d %d %d' % (pattern, offset, len) cmd = ['qemu-io', '-f', format, '-c', write_cmd, path] - rc, out, err = commands.execCmd(cmd, raw=True) + rc, out, err = commands.execCmd(cmd) if rc != 0: raise cmdutils.Error(cmd, rc, out, err) @@ -331,7 +331,7 @@ def qemu_pattern_verify(path, format, offset=512, len=1024, pattern=5): read_cmd = 'read -P %d -s 0 -l %d %d %d' % (pattern, len, offset, len) cmd = ['qemu-io', '-f', format, '-c', read_cmd, path] - rc, out, err = commands.execCmd(cmd, raw=True) + rc, out, err = commands.execCmd(cmd) if rc != 0 or err != "": raise cmdutils.Error(cmd, rc, out, err) if "Pattern verification failed" in out: diff --git a/tests/v2v_test.py b/tests/v2v_test.py index 6f2f94e..e7e5472 100644 --- a/tests/v2v_test.py +++ b/tests/v2v_test.py @@ -455,7 +455,7 @@ self.domain_id), self.vm_name] - rc, output, error = execCmd(cmd, raw=True) + rc, output, error = execCmd(cmd) self.assertEqual(rc, 0) with open('fake-virt-v2v.out', 'r') as f: diff --git a/vdsm_hooks/hostusb/after_vm_destroy.py b/vdsm_hooks/hostusb/after_vm_destroy.py index a2dd6cb..57e3136 100755 --- a/vdsm_hooks/hostusb/after_vm_destroy.py +++ b/vdsm_hooks/hostusb/after_vm_destroy.py @@ -46,7 +46,7 @@ # remove the 0x from the vendor and product id devid = vendorid[2:] + ':' + productid[2:] command = ['lsusb', '-d', devid] - retcode, out, err = hooking.execCmd(command, raw=True) + retcode, out, err = hooking.execCmd(command) if retcode != 0: sys.stderr.write('hostusb: cannot find usb device: %s\n' % devid) sys.exit(2) @@ -62,7 +62,7 @@ # we don't use os.chown because we need sudo owner = str(uid) + ':' + str(gid) command = ['/bin/chown', owner, devpath] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('hostusb after_vm_destroy: error chown %s to %s, ' 'err = %s\n' % (devpath, owner, err)) diff --git a/vdsm_hooks/hostusb/before_vm_start.py b/vdsm_hooks/hostusb/before_vm_start.py index 878cc75..a3a7ce9 100755 --- a/vdsm_hooks/hostusb/before_vm_start.py +++ b/vdsm_hooks/hostusb/before_vm_start.py @@ -65,7 +65,7 @@ # remove the 0x from the vendor and product id devid = vendorid[2:] + ':' + productid[2:] command = ['lsusb', '-d', devid] - retcode, out, err = hooking.execCmd(command, raw=True) + retcode, out, err = hooking.execCmd(command) if retcode != 0: sys.stderr.write('hostusb: cannot find usb device: %s\n' % devid) sys.exit(2) @@ -83,7 +83,7 @@ # we don't use os.chown because we need sudo owner = str(uid) + ':' + str(gid) command = ['/bin/chown', owner, devpath] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('hostusb: error chown %s to %s, err = %s\n' % (devpath, owner, err)) diff --git a/vdsm_hooks/localdisk/after_disk_prepare b/vdsm_hooks/localdisk/after_disk_prepare index b4f59e0..1ef69c2 100755 --- a/vdsm_hooks/localdisk/after_disk_prepare +++ b/vdsm_hooks/localdisk/after_disk_prepare @@ -165,7 +165,7 @@ "iflag=direct", "oflag=direct", "conv=sparse"] - rc, out, err = hooking.execCmd(cmd, raw=True) + rc, out, err = hooking.execCmd(cmd) if rc != 0: raise cmdutils.Error(cmd=cmd, rc=rc, out=out, err=err) @@ -213,7 +213,7 @@ def helper(*args): cmd = [HELPER] cmd.extend(args) - rc, out, err = hooking.execCmd(cmd, sudo=True, raw=True) + rc, out, err = hooking.execCmd(cmd, sudo=True) if rc != 0: raise cmdutils.Error(cmd=HELPER, rc=rc, out=out, err=err) return out diff --git a/vdsm_hooks/localdisk/localdisk-helper b/vdsm_hooks/localdisk/localdisk-helper index d0e5b94..dbf06e9 100755 --- a/vdsm_hooks/localdisk/localdisk-helper +++ b/vdsm_hooks/localdisk/localdisk-helper @@ -73,7 +73,7 @@ def lvm(*args): cmd = ["/usr/sbin/lvm"] cmd.extend(args) - rc, out, err = commands.execCmd(cmd, raw=True) + rc, out, err = commands.execCmd(cmd) if rc != 0: raise cmdutils.Error(cmd=cmd, rc=rc, out=out, err=err) return out diff --git a/vdsm_hooks/openstacknet/openstacknet_utils.py b/vdsm_hooks/openstacknet/openstacknet_utils.py index 67ba2ac..fd282d8 100644 --- a/vdsm_hooks/openstacknet/openstacknet_utils.py +++ b/vdsm_hooks/openstacknet/openstacknet_utils.py @@ -41,7 +41,7 @@ def executeOrExit(command): - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: raise RuntimeError("Failed to execute %s, due to: %s" % (command, err)) @@ -59,7 +59,7 @@ def deviceExists(dev): command = [EXT_IP, 'link', 'show', 'dev', dev] - retcode, out, err = hooking.execCmd(command, raw=True) + retcode, out, err = hooking.execCmd(command) return retcode == 0 diff --git a/vdsm_hooks/promisc/after_vm_start.py b/vdsm_hooks/promisc/after_vm_start.py index 43d63ce..30f48c5 100755 --- a/vdsm_hooks/promisc/after_vm_start.py +++ b/vdsm_hooks/promisc/after_vm_start.py @@ -39,7 +39,7 @@ ''' command = ['/sbin/tc', 'qdisc', 'add', 'dev', networkName, 'ingress'] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('promisc: error executing command "%s" error: %s' % (command, err)) @@ -48,7 +48,7 @@ command = ['/sbin/tc', 'filter', 'add', 'dev', networkName, 'parent', 'ffff:', 'protocol', 'ip', 'u32', 'match', 'u8', '0', '0', 'action', 'mirred', 'egress', mode, 'dev', ifaceName] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('promisc: error executing command "%s" error: %s' % (command, err)) @@ -56,14 +56,14 @@ command = ['/sbin/tc', 'qdisc', 'replace', 'dev', networkName, 'parent', 'root', 'prio'] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('promisc: error executing command "%s" error: %s' % (command, err)) sys.exit(2) command = ['/sbin/tc', 'qdisc', 'show', 'dev', networkName] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('promisc: error executing command "%s" error: %s' % (command, err)) @@ -76,7 +76,7 @@ command = ['/sbin/tc', 'filter', 'add', 'dev', networkName, 'parent', devId, 'protocol', 'ip', 'u32', 'match', 'u8', '0', '0', 'action', 'mirred', 'egress', mode, 'dev', ifaceName] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('promisc: error executing command "%s" error: %s' % (command, err)) @@ -84,7 +84,7 @@ # add promisc mode to the bridge command = ['/sbin/ifconfig', networkName, 'promisc'] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('promisc: error executing command "%s" error: %s' % (command, err)) diff --git a/vdsm_hooks/promisc/before_vm_destroy.py b/vdsm_hooks/promisc/before_vm_destroy.py index 5cef1a4..ab5c0ac 100755 --- a/vdsm_hooks/promisc/before_vm_destroy.py +++ b/vdsm_hooks/promisc/before_vm_destroy.py @@ -16,20 +16,20 @@ ''' command = ['/sbin/tc', 'qdisc', 'del', 'dev', networkName, 'root'] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('promisc: error executing command "%s" error: %s' % (command, err)) command = ['/sbin/tc', 'qdisc', 'del', 'dev', networkName, 'ingress'] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('promisc: error executing command "%s" error: %s' % (command, err)) # remove promisc mode flag from the bridge command = ['/sbin/ifconfig', networkName, '-promisc'] - retcode, out, err = hooking.execCmd(command, sudo=True, raw=True) + retcode, out, err = hooking.execCmd(command, sudo=True) if retcode != 0: sys.stderr.write('promisc: error executing command "%s" error: %s' % (command, err)) diff --git a/vdsm_hooks/scratchpad/before_vm_start.py b/vdsm_hooks/scratchpad/before_vm_start.py index 4acdb69..f62c95a 100755 --- a/vdsm_hooks/scratchpad/before_vm_start.py +++ b/vdsm_hooks/scratchpad/before_vm_start.py @@ -34,7 +34,7 @@ Create image file ''' command = ['/usr/bin/qemu-img', 'create', '-f', 'raw', path, size] - retcode, out, err = hooking.execCmd(command, raw=True) + retcode, out, err = hooking.execCmd(command) if retcode != 0: sys.stderr.write('scratchpad: error running command %s, err = %s\n' % (' '.join(command), err)) -- To view, visit https://gerrit.ovirt.org/80214 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2ab6d9dca564da2dd61923888fad0be94afee8c9 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg <[email protected]> _______________________________________________ vdsm-patches mailing list -- [email protected] To unsubscribe send an email to [email protected]
