cfg-checker benchmark module part 2

 - fixes for fio-runner error handling
 - fixes for web-server error handling
 - proper handling of 'scheduled_to' option
 - cleanup procedure
 - kube can wait for specific phases of svc, pod, pvc, pv

Change-Id: I9b241597e6314fed1dbc3aba5e8dee1637eea1c7
diff --git a/cfg_checker/modules/ceph/__init__.py b/cfg_checker/modules/ceph/__init__.py
index 9d0f923..d3f9581 100644
--- a/cfg_checker/modules/ceph/__init__.py
+++ b/cfg_checker/modules/ceph/__init__.py
@@ -92,6 +92,11 @@
         metavar='task-file',
         help="Task file for benchmark"
     )
+    ceph_bench_parser.add_argument(
+        '--no-cleanup',
+        action="store_true", default=False,
+        help="Do not cleanup services, agents, pvc, and pv"
+    )
 
     return _parser
 
@@ -149,9 +154,9 @@
     args_utils.check_supported_env(ENV_TYPE_KUBE, args, config)
     _filename = args_utils.get_arg(args, 'html')
     # agents count option
-    _agents = args_utils.get_arg(args, "agents")
-    logger_cli.info("-> using {} agents".format(_agents))
-    config.bench_agent_count = _agents
+    config.bench_agent_count = args_utils.get_arg(args, "agents")
+    logger_cli.info("-> using {} agents".format(config.bench_agent_count))
+    config.no_cleaning_after_benchmark = args_utils.get_arg(args, "no_cleanup")
     # storage class
     _storage_class = args_utils.get_arg(args, "storage_class")
     logger_cli.info("-> using storage class of '{}'".format(_storage_class))
@@ -179,8 +184,10 @@
     # Do the testrun
     ceph_bench.prepare_agents(_opts)
     if not ceph_bench.run_benchmark(_opts):
+        # No cleaning and/or report if benchmark was not finished
         return
-    ceph_bench.cleanup()
+    if not config.no_cleaning_after_benchmark:
+        ceph_bench.cleanup()
 
     # Create report
     ceph_bench.create_report(_filename)