Skip to content

Commit

Permalink
Reduce the noise that is being generated with the new exec_command
Browse files Browse the repository at this point in the history
This commit attempts to reduce the noise that is being generated
with the new exec_command.

Here, we remove gather cluster status for every orch operation as
cephadm has evolved. The verbose logging is disabled in cephadm
as it is logging to stderr.

Switching to pretty_print for cases it is required.

Signed-off-by: Pragadeeswaran Sathyanarayanan <pragadeeswaran.sathyanarayanan@ibm.com>
  • Loading branch information
psathyan committed Sep 20, 2024
1 parent 4c2a890 commit fbe5208
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions ceph/ceph_admin/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,9 +861,7 @@ def get_cluster_state(cls, commands=None):
__CLUSTER_STATE_COMMANDS.extend(commands)

for cmd in __CLUSTER_STATE_COMMANDS:
out, err = cls.shell(args=[cmd])
LOG.info("STDOUT:\n %s" % out)
LOG.error("STDERR:\n %s" % err)
cls.shell(args=[cmd], pretty_print=True)


def get_host_osd_map(cls):
Expand Down
5 changes: 4 additions & 1 deletion ceph/ceph_admin/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .typing_ import CephAdmProtocol

LOG = Log(__name__)
BASE_CMD = ["cephadm", "-v", "shell"]
BASE_CMD = ["cephadm", "shell"]


class ShellMixin:
Expand All @@ -23,6 +23,7 @@ def shell(
timeout: int = 600,
long_running: bool = False,
print_output: bool = True,
pretty_print: bool = False,
):
"""
Ceph orchestrator shell interface to run ceph commands.
Expand All @@ -34,6 +35,7 @@ def shell(
timeout (Int): Maximum time allowed for execution.
long_running (Bool): Long running command (default: False)
print_output ( Bool): Flag to decide whether the output should be printed in log or not
pretty_print (Bool): Flag to decide whether the output should be printed or not
Returns:
out (Str), err (Str) stdout and stderr response
Expand All @@ -54,6 +56,7 @@ def shell(
timeout=timeout,
check_ec=check_status,
long_running=long_running,
pretty_print=pretty_print,
)

if isinstance(out, tuple):
Expand Down
3 changes: 1 addition & 2 deletions tests/ceph_installer/test_cephadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ def run(ceph_cluster: Ceph, **kwargs) -> int:

except BaseException as be: # noqa
LOG.error(be, exc_info=True)
return 1
finally:
LOG.debug("Gathering cluster state after running test_cephadm")
get_cluster_state(cephadm)

return 0

0 comments on commit fbe5208

Please sign in to comment.