]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/vstart_runner: don't use "shell=False" in run_ceph_w()
authorRishabh Dave <ridave@redhat.com>
Fri, 30 Jul 2021 16:00:02 +0000 (21:30 +0530)
committerRishabh Dave <ridave@redhat.com>
Mon, 2 Aug 2021 06:07:44 +0000 (11:37 +0530)
Instead prepend "exec sudo" to the command arguments of
LocalCephManager.run_ceph_w(). This makes the default parameter
"shell=False" redundant in case of
ceph_manager.CephManager.run_ceph_w(), so get rid of it too and update
calls to run_ceph_w() accordingly.

The reason behind using any of these workarounds is that running "ceph
-w" with "shell" set to True leads to crash for Ceph API CI job. See
this ticket for more details: https://tracker.ceph.com/issues/49644.

The reason behind switching the workaround is that in the following
commits to reduce duplication LocalCephManager.run_ceph_w() will be
deleted and CephManager.run_ceph_w() will be used by LocalCephManager
via inheritance. However, due to the issue described above, Ceph API
test will fail since "shell" is set to "True" for the command issued by
CephManager.run_ceph_w(). Prepending "exec sudo" to the command when it
is used in LocalCephManager makes this duplication unnecessary and also
prevents Ceph API test from failing.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/ceph_manager.py
qa/tasks/ceph_test_case.py
qa/tasks/vstart_runner.py

index 15ed5d08b97f18e9db7342280dea8f1ab4238b7f..3dca41832ed496ed98a3d02fa89fad1b40c74a63 100644 (file)
@@ -1594,14 +1594,7 @@ class CephManager:
         kwargs['check_status'] = False
         return self.run_cluster_cmd(**kwargs).exitstatus
 
-    # 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):
+    def run_ceph_w(self, watch_channel=None):
         """
         Execute "ceph -w" in the background with stdout connected to a BytesIO,
         and return the RemoteProcess.
index 2ca17b34ce37b007432bc52c6786628b04468606..7040853dfb437ff54ccb53031e46b67662d76132 100644 (file)
@@ -110,10 +110,7 @@ class CephTestCase(unittest.TestCase):
                 return found
 
             def __enter__(self):
-                # 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)
+                self.watcher_process = ceph_manager.run_ceph_w(watch_channel)
 
             def __exit__(self, exc_type, exc_val, exc_tb):
                 if not self.watcher_process.finished:
index 851816b2c3df595db14a2759ad28d474198891d3..5b68167b0b6d86903f4f1c952e5b45952770e221 100644 (file)
@@ -795,20 +795,27 @@ class LocalCephManager(CephManager):
         """
         return LocalRemote()
 
-    # 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):
+    def run_ceph_w(self, watch_channel=None):
         """
         :param watch_channel: Specifies the channel to be watched.
                               This can be 'cluster', 'audit', ...
         :type watch_channel: str
         """
-        args = [CEPH_CMD, "-w"]
+        # XXX: Ceph API test CI job crashes because "ceph -w" process launched
+        # by run_ceph_w() crashes when shell is set to True.
+        # See https://tracker.ceph.com/issues/49644.
+        #
+        # The 2 possible workaround this are either setting "shell" to "False"
+        # when command "ceph -w" is executed or to prepend "exec sudo" to
+        # command arguments. We are going with latter since former would make
+        # it necessary to pass "shell" parameter to run() method. This leads
+        # to incompatibility with the method teuthology.orchestra.run's run()
+        # since it doesn't accept "shell" as parameter.
+        args = ['exec', 'sudo', CEPH_CMD, "-w"]
         if watch_channel is not None:
             args.append("--watch-channel")
             args.append(watch_channel)
-        proc = self.controller.run(args=args, wait=False, stdout=StringIO(),
-                                   shell=shell)
+        proc = self.controller.run(args=args, wait=False, stdout=StringIO())
         return proc
 
     def run_cluster_cmd(self, **kwargs):