Merge PR #38443 into master

* refs/pull/38443/head:
	qa: set "shell" to False for run_ceph_w()
	vstart_runner: make "shell" a default argument

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
This commit is contained in:
Patrick Donnelly 2021-03-22 20:00:46 -07:00
commit 42270a5338
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
3 changed files with 20 additions and 6 deletions

View File

@ -1566,7 +1566,14 @@ class CephManager:
kwargs['check_status'] = False
return self.run_cluster_cmd(**kwargs).exitstatus
def run_ceph_w(self, watch_channel=None):
# XXX: Setting "shell" to True for LocalCephManager.run_ceph_w(), doesn't
# work with vstart_runner.py; see https://tracker.ceph.com/issues/49644.
# shell=False as default parameter is just to maintain compatibility
# between interfaces of CephManager.run_ceph_w() and
# LocalCephManager.run_ceph_w(). This doesn't affect how "ceph -w" process
# is launched by this method since this parameters remains unused in
# this method.
def run_ceph_w(self, watch_channel=None, shell=False):
"""
Execute "ceph -w" in the background with stdout connected to a BytesIO,
and return the RemoteProcess.

View File

@ -110,7 +110,10 @@ class CephTestCase(unittest.TestCase):
return found
def __enter__(self):
self.watcher_process = ceph_manager.run_ceph_w(watch_channel)
# XXX: For reason behind setting "shell" to False, see
# https://tracker.ceph.com/issues/49644.
self.watcher_process = ceph_manager.run_ceph_w(watch_channel,
shell=False)
def __exit__(self, exc_type, exc_val, exc_tb):
if not self.watcher_process.finished:

View File

@ -406,11 +406,12 @@ class LocalRemote(object):
# vstart_runner.py.
def _do_run(self, args, check_status=True, wait=True, stdout=None,
stderr=None, cwd=None, stdin=None, logger=None, label=None,
env=None, timeout=None, omit_sudo=True):
env=None, timeout=None, omit_sudo=True, shell=True):
args = self._perform_checks_and_return_list_of_args(args, omit_sudo)
# We have to use shell=True if any run.Raw was present, e.g. &&
shell = any([a for a in args if isinstance(a, Raw)])
if not shell:
shell = any([a for a in args if isinstance(a, Raw)])
# Filter out helper tools that don't exist in a vstart environment
args = [a for a in args if a not in ('adjust-ulimits',
@ -780,7 +781,9 @@ class LocalCephManager(CephManager):
"""
return LocalRemote()
def run_ceph_w(self, watch_channel=None):
# XXX: For reason behind setting "shell" to False, see
# https://tracker.ceph.com/issues/49644.
def run_ceph_w(self, watch_channel=None, shell=False):
"""
:param watch_channel: Specifies the channel to be watched.
This can be 'cluster', 'audit', ...
@ -790,7 +793,8 @@ class LocalCephManager(CephManager):
if watch_channel is not None:
args.append("--watch-channel")
args.append(watch_channel)
proc = self.controller.run(args=args, wait=False, stdout=StringIO())
proc = self.controller.run(args=args, wait=False, stdout=StringIO(),
shell=shell)
return proc
def run_cluster_cmd(self, **kwargs):