Ceph Info command
Updates
- ceph module with 'info', 'report' and 'bench' commands
- mcp-checker ceph info command is collecting Ceph config
and creates an archive
- ceph report command creates HTML document with
info collected from Ceph cluster
- Basic SMART data output in info and full output in report
- skeleton of the ceph bench command to run synced tests
Fixes
- kube helper commands uses proper naming
Change-Id: Ia5aaa343f7d1c38a67d34e60215801bbb0fea097
Related-PROD: PROD-36605
diff --git a/cfg_checker/modules/ceph/__init__.py b/cfg_checker/modules/ceph/__init__.py
new file mode 100644
index 0000000..ad4a207
--- /dev/null
+++ b/cfg_checker/modules/ceph/__init__.py
@@ -0,0 +1,150 @@
+from cfg_checker.common import logger_cli
+from cfg_checker.common.settings import ENV_TYPE_KUBE
+from cfg_checker.helpers import args_utils
+from cfg_checker.modules.ceph import info, bench
+
+command_help = "Ceph Storage information and benchmarks"
+supported_envs = [ENV_TYPE_KUBE]
+
+
+# def _selectClass(_env, strClassHint="checker"):
+# _class = None
+# if _env == ENV_TYPE_SALT:
+# if strClassHint == "info":
+# _class = info.SaltCephInfo
+# elif strClassHint == "bench":
+# _class = bench.SaltCephInfo
+# elif _env == ENV_TYPE_KUBE:
+# if strClassHint == "info":
+# _class = info.KubeCephInfo
+# elif strClassHint == "bench":
+# _class = bench.KubeCephBench
+# if not _class:
+# raise CheckerException(
+# "Unknown hint for selecting Ceph handler Class: '{}'".format(
+# strClassHint
+# )
+# )
+# else:
+# return _class
+
+
+def init_parser(_parser):
+ # network subparser
+ ceph_subparsers = _parser.add_subparsers(dest='type')
+
+ ceph_info_parser = ceph_subparsers.add_parser(
+ 'info',
+ help="Gather Ceph Cluster information"
+ )
+
+ ceph_info_parser.add_argument(
+ '--detailed',
+ action="store_true", default=False,
+ help="Print additional details"
+ )
+
+ ceph_info_parser.add_argument(
+ '--tgz',
+ metavar='ceph_tgz_filename',
+ help="HTML filename to save report"
+ )
+
+ ceph_report_parser = ceph_subparsers.add_parser(
+ 'report',
+ help="Generate network check report"
+ )
+
+ ceph_report_parser.add_argument(
+ '--html',
+ metavar='ceph_html_filename',
+ help="HTML filename to save report"
+ )
+
+ ceph_bench_parser = ceph_subparsers.add_parser(
+ 'bench',
+ help="Run ceph benchmark"
+ )
+
+ ceph_bench_parser.add_argument(
+ '--task-list',
+ metavar='ceph_tasks_filename',
+ help="List file with data for Ceph bench testrun"
+ )
+
+ return _parser
+
+
+def do_info(args, config):
+ # Ceph info
+ # Gather ceph info and create an archive with data
+ args_utils.check_supported_env(ENV_TYPE_KUBE, args, config)
+ # check tgz
+ _tgzfile = "ceph_info_archive.tgz" if not args.tgz else args.tgz
+
+ # _class = _selectClass(_env)
+ ceph_info = info.KubeCephInfo(config)
+
+ logger_cli.info("# Collecting Ceph cluster information")
+ logger_cli.warning(
+ "\nWARNING: 'ceph info' has 'Work in progress' status!\n"
+ )
+
+ ceph_info.gather_info()
+
+ # Debug, enable if needed to debug report generation
+ # without actuall data collecting each time
+ # ceph_info.dump_info()
+ # ceph_info.load_info()
+ # end debug
+
+ ceph_info.print_summary()
+ ceph_info.generate_archive(_tgzfile)
+
+ return
+
+
+def do_report(args, config):
+ # Ceph Report
+ # Gather ceph info and create HTML report with all of the data
+ args_utils.check_supported_env(ENV_TYPE_KUBE, args, config)
+ _filename = args_utils.get_arg(args, 'html')
+ logger_cli.info("# Ceph cluster Configuration report")
+ logger_cli.warning(
+ "\nWARNING: 'ceph info' has 'Work in progress' status!\n"
+ )
+
+ # _class = _selectClass(_env)
+ ceph_info = info.KubeCephInfo(config)
+ # Debug, enable if needed to debug report generation
+ # without actuall data collecting each time
+ # ceph_info.load_info()
+ # end debug
+ ceph_info.gather_info()
+ ceph_info.get_transposed_latency_table()
+ ceph_info.get_latest_health_readout()
+ ceph_info.create_html_report(_filename)
+
+ return
+
+
+def do_bench(args, config):
+ # Ceph Benchmark using multiple pods
+ # Prepare the tasks and do synced testrun
+ # TODO: html option to create a fancy report
+ args_utils.check_supported_env(ENV_TYPE_KUBE, args, config)
+
+ ceph_bench = bench.KubeCephBench(config)
+
+ logger_cli.error("ERROR: To be implemented...")
+
+ # Load tasks
+
+ # Do the testrun
+ ceph_bench.prepare_pods()
+ ceph_bench.run_benchmark()
+
+ # Create report
+ ceph_bench.create_report()
+
+ return