diff --git a/README.md b/README.md index 2c25c73..b6ee89c 100644 --- a/README.md +++ b/README.md @@ -49,14 +49,14 @@ However if you do wish to use the Python interface: - All tests require a HCResults instance to be passed ``` from ovs.extensions.healthcheck.result import HCResults -from ovs.extensions.healthcheck.arakoon_hc import ArakoonHealthCheck +from ovs.extensions.healthcheck.suites.arakoon_hc import ArakoonHealthCheck result = HCResults() ArakoonHealthCheck.check_collapse(result) ``` If you wish to capture output: a named HCResults must be passed. This way a single result instance can capture all test outputs ``` from ovs.extensions.healthcheck.result import HCResults -from ovs.extensions.healthcheck.arakoon_hc import ArakoonHealthCheck +from ovs.extensions.healthcheck.suites.arakoon_hc import ArakoonHealthCheck result = HCResults() ArakoonHealthCheck.check_collapse(result.HCResultCollector(result=result, test_name='collapse-test')) # Output diff --git a/ovs/extensions/healthcheck/expose_to_cli.py b/ovs/extensions/healthcheck/expose_to_cli.py index a595c7c..78e0be2 100644 --- a/ovs/extensions/healthcheck/expose_to_cli.py +++ b/ovs/extensions/healthcheck/expose_to_cli.py @@ -14,6 +14,11 @@ # Open vStorage is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY of any kind. + +""" +Expose to CLI module. Depends on the python-click library +""" + from __future__ import absolute_import import os @@ -29,10 +34,6 @@ from ovs.extensions.storage.volatilefactory import VolatileFactory from ovs.extensions.healthcheck.logger import Logger -""" -Expose to CLI module. Depends on the python-click library -""" - # @todo Make it recursive. Current layout enforces SUBMODULE COMMAND, SUBMODULE, SUB, COMMAND is not possible @@ -172,16 +173,18 @@ def discover(): for filename in filenames: if not (filename.endswith('.py') and filename != '__init__.py'): continue - module_name = filename.replace('.py', '') file_path = os.path.join(root, filename) relative_path = os.path.relpath(file_path, path) relative_module_name = ''.join(os.path.split(relative_path.replace('.py', ''))) # Import file, making it relative to the start path to avoid name collision. # Without it, the module contents would be merged (eg. alba.py and testing/alba.py would be merged, overriding the path # imp.load_source is different from importing. Therefore using the relative-joined name is safe - mod = imp.load_source(relative_module_name, file_path) + try: + mod = imp.load_source(relative_module_name, file_path) + except ImportError: + cls.logger.exception('Unable to import module at {0}'.format(file_path)) for member_name, member_value in inspect.getmembers(mod): - if not (inspect.isclass(member_value) and member_value.__module__ == module_name and 'object' in [base.__name__ for base in member_value.__bases__]): + if not (inspect.isclass(member_value) and member_value.__module__ == relative_module_name and 'object' in [base.__name__ for base in member_value.__bases__]): continue for submember_name, submember_value in inspect.getmembers(member_value): if not hasattr(submember_value, expose_to_cli.attribute): @@ -308,7 +311,7 @@ class HealthcheckTerminatedException(KeyboardInterrupt): """ -class HealthcheckCLiContext(CLIContext): +class HealthCheckCLiContext(CLIContext): """ Context object which holds some information """ @@ -473,7 +476,7 @@ def run_methods_in_module(self, ctx): return -class HealthcheckCLI(CLI): +class HealthCheckCLI(CLI): """ Click CLI which dynamically loads all possible commands """ @@ -494,7 +497,7 @@ def __init__(self, *args, **kwargs): Initializes a CLI instance Injects a healthcheck specific callback """ - super(HealthcheckCLI, self).__init__(chain=True, + super(HealthCheckCLI, self).__init__(chain=True, invoke_without_command=True, result_callback=self.healthcheck_result_handler, *args, **kwargs) @@ -513,7 +516,7 @@ def parse_args(self, ctx, args): if self.TO_JSON in args: args.remove(self.TO_JSON) args.insert(0, self.TO_JSON) - super(HealthcheckCLI, self).parse_args(ctx, args) + super(HealthCheckCLI, self).parse_args(ctx, args) def get_command(self, ctx, name): # type: (click.Context, str) -> HealthcheckAddonGroup @@ -547,16 +550,16 @@ def healthcheck_result_handler(ctx, result, *args, **kwargs): def main(self, args=None, prog_name=None, complete_var=None, standalone_mode=False, **extra): # type: (list, str, bool, bool, **any) -> None try: - super(HealthcheckCLI, self).main(args, prog_name, complete_var, standalone_mode, **extra) + super(HealthCheckCLI, self).main(args, prog_name, complete_var, standalone_mode, **extra) except (HealthcheckTerminatedException, click.Abort, KeyboardInterrupt): - # Raised when an invoked command was abborted. The invoked command will output all results and then raise the exception + # Raised when an invoked command was aborted. The invoked command will output all results and then raise the exception pass except click.ClickException as e: e.show() sys.exit(e.exit_code) -@click.group(cls=HealthcheckCLI) +@click.group(cls=HealthCheckCLI) @click.option('--unattended', is_flag=True, help='Only output the results in a compact format') @click.option('--to-json', is_flag=True, help='Only output the results in a JSON format') @click.pass_context @@ -568,11 +571,11 @@ def healthcheck_entry_point(ctx, unattended, to_json): # Will be the 'callback' method for the HealthcheckCLi instance # Provide a new instance of the results to collect all results within the complete healthcheck result_handler = HCResults(unattended=unattended, to_json=to_json) - ctx.obj = HealthcheckCLiContext(result_handler) + ctx.obj = HealthCheckCLiContext(result_handler) # When run with subcommand, it will fetch the command to execute if ctx.invoked_subcommand is None: # Invoked without sub command. Run all functions. - cli_instance = ctx.command # type: HealthcheckCLI + cli_instance = ctx.command # type: HealthCheckCLI for sub_command in cli_instance.list_commands(ctx): ctx.invoke(cli_instance.get_command(ctx, sub_command)) return diff --git a/ovs/extensions/healthcheck/suites/__init__.py b/ovs/extensions/healthcheck/suites/__init__.py new file mode 100644 index 0000000..64eed0b --- /dev/null +++ b/ovs/extensions/healthcheck/suites/__init__.py @@ -0,0 +1,19 @@ +# Copyright (C) 2018 iNuron NV +# +# This file is part of Open vStorage Open Source Edition (OSE), +# as available from +# +# http://www.openvstorage.org and +# http://www.openvstorage.com. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License v3 (GNU AGPLv3) +# as published by the Free Software Foundation, in version 3 as it comes +# in the LICENSE.txt file of the Open vStorage OSE distribution. +# +# Open vStorage is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY of any kind. + +""" +Suites module which contain all testing logic +""" \ No newline at end of file diff --git a/ovs/extensions/healthcheck/alba.py b/ovs/extensions/healthcheck/suites/alba.py similarity index 99% rename from ovs/extensions/healthcheck/alba.py rename to ovs/extensions/healthcheck/suites/alba.py index 26df579..a8a6ee3 100755 --- a/ovs/extensions/healthcheck/alba.py +++ b/ovs/extensions/healthcheck/suites/alba.py @@ -33,7 +33,7 @@ from ovs.extensions.generic.system import System from ovs.extensions.healthcheck.config.error_codes import ErrorCodes from ovs.extensions.healthcheck.decorators import cluster_check -from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthcheckCLI +from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthCheckCLI from ovs.extensions.healthcheck.helpers.albacli import AlbaCLI from ovs.extensions.healthcheck.helpers.backend import BackendHelper from ovs.extensions.healthcheck.helpers.exceptions import AlbaException, AlbaTimeOutException, ConfigNotMatchedException,\ @@ -148,7 +148,7 @@ def _check_backend_asds(cls, result_handler, asds, backend_name, config): return result @classmethod - @expose_to_cli(MODULE, 'proxy-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'proxy-test', HealthCheckCLI.ADDON_TYPE, help='Verifies that the proxies are able to perform basic operations', short_help='Test if proxy basic operations') def check_if_proxies_work(cls, result_handler): @@ -422,7 +422,7 @@ def _get_all_responding_backends(result_handler): @staticmethod @cluster_check - @expose_to_cli(MODULE, 'backend-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'backend-test', HealthCheckCLI.ADDON_TYPE, help='Verifies that the backends are still usable', short_help='Test if backends are usable') def check_backends(result_handler): @@ -484,7 +484,7 @@ def check_backends(result_handler): @staticmethod @cluster_check - @expose_to_cli(MODULE, 'disk-safety-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'disk-safety-test', HealthCheckCLI.ADDON_TYPE, help='Verifies that namespaces have enough safety', short_help='Test if namespaces have enough safety') def check_disk_safety(result_handler): @@ -593,7 +593,7 @@ def get_disk_safety(cls, result_handler): # @todo: incorporate asd-manager code to check the service @staticmethod - @expose_to_cli(MODULE, 'processes-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'processes-test', HealthCheckCLI.ADDON_TYPE, help='Verifies that the local Alba processes are still running', short_help='Test if Alba processes are running') def check_alba_processes(result_handler): @@ -620,7 +620,7 @@ def check_alba_processes(result_handler): code=ErrorCodes.alba_service_down) @staticmethod - @expose_to_cli(MODULE, 'proxy-port-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'proxy-port-test', HealthCheckCLI.ADDON_TYPE, help='Verifies that the proxies are still listening on their socket', short_help='Test if proxies are still listening') def check_alba_proxy_ports(result_handler): @@ -644,7 +644,7 @@ def check_alba_proxy_ports(result_handler): @classmethod @cluster_check - @expose_to_cli(MODULE, 'nsm-load-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'nsm-load-test', HealthCheckCLI.ADDON_TYPE, help='Verifies that the Namespace Managers are not overloaded', short_help='Test if NSMs are not overloaded') def check_nsm_load(cls, result_handler): diff --git a/ovs/extensions/healthcheck/arakoon.py b/ovs/extensions/healthcheck/suites/arakoon.py similarity index 99% rename from ovs/extensions/healthcheck/arakoon.py rename to ovs/extensions/healthcheck/suites/arakoon.py index a3b38cc..ad6b525 100644 --- a/ovs/extensions/healthcheck/arakoon.py +++ b/ovs/extensions/healthcheck/suites/arakoon.py @@ -37,7 +37,7 @@ from ovs_extensions.generic.toolbox import ExtensionsToolbox from ovs.extensions.healthcheck.decorators import cluster_check from ovs.extensions.healthcheck.config.error_codes import ErrorCodes -from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthcheckCLI +from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthCheckCLI from ovs.extensions.healthcheck.helpers.network import NetworkHelper from ovs.extensions.healthcheck.logger import Logger from ovs.extensions.services.servicefactory import ServiceFactory @@ -83,7 +83,7 @@ def _get_arakoon_clusters(cls, result_handler): @classmethod @cluster_check - @expose_to_cli(MODULE, 'nodes-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'nodes-test', HealthCheckCLI.ADDON_TYPE, help='Verify if nodes are missing and if nodes are catching up to the master', short_help='Test if there are nodes missing/catching up') @expose_to_cli.option('--max-transactions-behind', type=int, default=10, help='The number of transactions that a slave can be behind a master before logging a failure') @@ -142,7 +142,7 @@ def check_node_status(cls, result_handler, max_transactions_behind=10): @classmethod @cluster_check - @expose_to_cli(MODULE, 'ports-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'ports-test', HealthCheckCLI.ADDON_TYPE, help='Verifies that the Arakoon clusters still respond to connections', short_help='Test if Arakoons accepts connections') def check_arakoon_ports(cls, result_handler): @@ -250,7 +250,7 @@ def _connection_worker(queue, result_handler): @classmethod @cluster_check - @expose_to_cli(MODULE, 'collapse-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'collapse-test', HealthCheckCLI.ADDON_TYPE, help='Verifies collapsing has occurred for all Arakoons', short_help='Test if Arakoon collapsing is not failing') @expose_to_cli.option('--max-collapse-age', type=int, default=3, help='Maximum age in days for TLX') @@ -321,7 +321,7 @@ def check_collapse(cls, result_handler, max_collapse_age=3, min_tlx_amount=10): continue if len(headdb_files) > 0: headdb_size = sum([int(i[2]) for i in headdb_files]) - collapse_size_msg = 'Spare space for local collapse is ' + collapse_size_msg = 'Spare space for local collapse is' if avail_size >= headdb_size * 4: result_handler.success('{0} sufficient (n > 4x head.db size)'.format(collapse_size_msg)) elif avail_size >= headdb_size * 3: @@ -450,7 +450,7 @@ def _collapse_worker(queue, clients, result_handler): @classmethod @cluster_check - @expose_to_cli(MODULE, 'integrity-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'integrity-test', HealthCheckCLI.ADDON_TYPE, help='Verifies that all Arakoon clusters are still responding to client calls', short_help='Test if Arakoon clusters are still responding') def verify_integrity(cls, result_handler): @@ -481,7 +481,7 @@ def verify_integrity(cls, result_handler): @classmethod @cluster_check - @expose_to_cli(MODULE, 'file-descriptors-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'file-descriptors-test', HealthCheckCLI.ADDON_TYPE, help='Verify the number of File Descriptors on every Arakoon does not exceed the limit', short_help='Test if #FD does not exceed the limit') @expose_to_cli.option('--fd-limit', type=int, default=30, help='Threshold for the number number of tcp connections for which to start logging warnings') diff --git a/ovs/extensions/healthcheck/generic.py b/ovs/extensions/healthcheck/suites/generic.py similarity index 96% rename from ovs/extensions/healthcheck/generic.py rename to ovs/extensions/healthcheck/suites/generic.py index 38867d7..ebdb1b5 100644 --- a/ovs/extensions/healthcheck/generic.py +++ b/ovs/extensions/healthcheck/suites/generic.py @@ -29,7 +29,7 @@ from ovs.extensions.generic.sshclient import SSHClient from ovs.extensions.generic.system import System from ovs.extensions.healthcheck.config.error_codes import ErrorCodes -from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthcheckCLI +from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthCheckCLI from ovs.extensions.healthcheck.helpers.filesystem import FilesystemHelper from ovs.extensions.healthcheck.helpers.helper import Helper from ovs.extensions.healthcheck.helpers.network import NetworkHelper @@ -53,7 +53,7 @@ class OpenvStorageHealthCheck(object): CELERY_CHECK_TIME = 7 @staticmethod - @expose_to_cli(MODULE, 'log-files-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'log-files-test', HealthCheckCLI.ADDON_TYPE, help='Verify that all log files are not too big', short_help='Test if log files are not too big') @expose_to_cli.option('--max-log-size', type=int, default=Helper.max_log_size, help='Maximum size of the file (in MB)') @@ -96,7 +96,7 @@ def get_log_files_by_path(start_path, recursive=True): result_handler.success('All log files are ok!', code=ErrorCodes.log_file_size) @staticmethod - @expose_to_cli(MODULE, 'port-ranges-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'port-ranges-test', HealthCheckCLI.ADDON_TYPE, help='Verify that there are enough ports remaining for OVS use', short_help='Test if there are enough ports remaining') @expose_to_cli.option('--requested-ports', type=int, default=20, help='Minimal number of ports') @@ -119,7 +119,7 @@ def check_port_ranges(result_handler, requested_ports=20): result_handler.warning('{} ports found, less than {}'.format(len(expected_ports), requested_ports)) @staticmethod - @expose_to_cli(MODULE, 'nginx-ports-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'nginx-ports-test', HealthCheckCLI.ADDON_TYPE, help='Verify that NGINX is reachable', short_help='Test if NGINX is reachable') def check_nginx_ports(result_handler): @@ -133,7 +133,7 @@ def check_nginx_ports(result_handler): return OpenvStorageHealthCheck._check_extra_ports(result_handler, 'nginx') @staticmethod - @expose_to_cli(MODULE, 'memcached-ports-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'memcached-ports-test', HealthCheckCLI.ADDON_TYPE, help='Verify that memcached is reachable', short_help='Test if memcached is reachable') def check_memcached_ports(result_handler): @@ -175,7 +175,7 @@ def _check_extra_ports(result_handler, key, ips=None): result_handler.failure('Connection FAILED to service {0} on {1}:{2}'.format(key, ip, port), code=getattr(ErrorCodes, 'port_{0}'.format(key))) @staticmethod - @expose_to_cli(MODULE, 'celery-ports-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'celery-ports-test', HealthCheckCLI.ADDON_TYPE, help='Verify that RabbitMQ is reachable', short_help='Test if RabbitMQ is reachable') def check_rabbitmq_ports(result_handler): @@ -209,7 +209,7 @@ def check_rabbitmq_ports(result_handler): result_handler.failure('Could not import the celery module. Got {}'.format(str(ex)), code=ErrorCodes.port_celery) @staticmethod - @expose_to_cli(MODULE, 'packages-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'packages-test', HealthCheckCLI.ADDON_TYPE, help='Verify that all required packages are installed', short_help='Test if all required packages are installed') def check_ovs_packages(result_handler): @@ -248,7 +248,7 @@ def check_ovs_packages(result_handler): result_handler.skip('Package {0} is not installed.'.format(package)) @staticmethod - @expose_to_cli(MODULE, 'processes-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'processes-test', HealthCheckCLI.ADDON_TYPE, help='Verify that all OVS related processes are running', short_help='Test if OVS processes are running') def check_ovs_processes(result_handler): @@ -289,7 +289,7 @@ def _check_celery(): return False @staticmethod - @expose_to_cli(MODULE, 'workers-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'workers-test', HealthCheckCLI.ADDON_TYPE, help='Verify that the ovs-workers are working', short_help='Test if the ovs-workers are working') def check_ovs_workers(result_handler): @@ -313,7 +313,7 @@ def check_ovs_workers(result_handler): result_handler.failure('The celery check has failed with {0}'.format(str(ex)), code=ErrorCodes.process_celery_timeout) @staticmethod - @expose_to_cli(MODULE, 'directories-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'directories-test', HealthCheckCLI.ADDON_TYPE, help='Verify that all OVS related directories have correct ownership and rights', short_help='Test if directories their ownership and rights are correct') def check_required_dirs(result_handler): @@ -350,7 +350,7 @@ def check_required_dirs(result_handler): result_handler.skip('Directory {0} does not exists!'.format(dirname)) @staticmethod - @expose_to_cli(MODULE, 'dns-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'dns-test', HealthCheckCLI.ADDON_TYPE, help='Verify that the node can resolve DNS names', short_help='Test if the node can resolve DNS names') def check_if_dns_resolves(result_handler, fqdn='google.com'): @@ -372,7 +372,7 @@ def check_if_dns_resolves(result_handler, fqdn='google.com'): code=ErrorCodes.dns_resolve_fail) @staticmethod - @expose_to_cli(MODULE, 'zombie-processes-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'zombie-processes-test', HealthCheckCLI.ADDON_TYPE, help='Verify that no zombie processes are running on the machine', short_help='Test if there are zombie processes running') def check_zombied_and_dead_processes(result_handler): @@ -416,7 +416,7 @@ def check_zombied_and_dead_processes(result_handler): code=ErrorCodes.process_dead_found) @staticmethod - @expose_to_cli(MODULE, 'model-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'model-test', HealthCheckCLI.ADDON_TYPE, help='Verify that the Framework model is in sync with the one from the Volumedriver', short_help='Test if Framework and Volumedriver model match') def check_model_consistency(result_handler): @@ -474,7 +474,7 @@ def check_model_consistency(result_handler): result_handler.success('No discrepancies found for voldrv in vpool {0}'.format(vp.name), code=ErrorCodes.missing_ovsdb) @staticmethod - @expose_to_cli(MODULE, 'verify-rabbitmq-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'verify-rabbitmq-test', HealthCheckCLI.ADDON_TYPE, help='Verify that RabbitMQ is properly running', short_help='Test if RabbitMQ is properly running') def verify_rabbitmq(result_handler): @@ -498,7 +498,7 @@ def verify_rabbitmq(result_handler): result_handler.skip('RabbitMQ is not running/active on this server!') @staticmethod - @expose_to_cli(MODULE, 'recovery-domain-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'recovery-domain-test', HealthCheckCLI.ADDON_TYPE, help='Verify that all recovery domains are setup as regular domain', short_help='Test if all recovery domains are setup as regular domain') def check_recovery_domains(result_handler): diff --git a/ovs/extensions/healthcheck/ipmi.py b/ovs/extensions/healthcheck/suites/ipmi.py similarity index 97% rename from ovs/extensions/healthcheck/ipmi.py rename to ovs/extensions/healthcheck/suites/ipmi.py index 325e302..eb5d834 100644 --- a/ovs/extensions/healthcheck/ipmi.py +++ b/ovs/extensions/healthcheck/suites/ipmi.py @@ -21,7 +21,7 @@ from ovs_extensions.generic.ipmi import IPMIController, IPMITimeOutException, IPMICallException from ovs.extensions.generic.sshclient import SSHClient from ovs.extensions.generic.system import System -from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthcheckCLI +from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthCheckCLI from ovs.extensions.healthcheck.logger import Logger @@ -33,7 +33,7 @@ class IPMIHealthCheck(object): logger = Logger("healthcheck-healthcheck_ipmi") @classmethod - @expose_to_cli(MODULE, 'ipmi-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'ipmi-test', HealthCheckCLI.ADDON_TYPE, help='Verify that AlbaNodes can be controlled through IPMI', short_help='Test if AlbaNodes their IPMI info is correct') def ipmi_check(cls, result_handler): diff --git a/ovs/extensions/healthcheck/volumedriver.py b/ovs/extensions/healthcheck/suites/volumedriver.py similarity index 98% rename from ovs/extensions/healthcheck/volumedriver.py rename to ovs/extensions/healthcheck/suites/volumedriver.py index edc2260..d1bc880 100644 --- a/ovs/extensions/healthcheck/volumedriver.py +++ b/ovs/extensions/healthcheck/suites/volumedriver.py @@ -20,7 +20,7 @@ from ovs.dal.hybrids.vdisk import VDisk from ovs.dal.lists.vpoollist import VPoolList from ovs.extensions.generic.system import System -from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthcheckCLI +from ovs.extensions.healthcheck.expose_to_cli import expose_to_cli, HealthCheckCLI from ovs.extensions.healthcheck.config.error_codes import ErrorCodes from ovs.extensions.healthcheck.helpers.exceptions import VDiskNotFoundError from ovs.extensions.healthcheck.helpers.vdisk import VDiskHelper @@ -67,7 +67,7 @@ class VolumedriverHealthCheck(object): logger = Logger('healthcheck-ovs_volumedriver') @staticmethod - @expose_to_cli(MODULE, 'dtl-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'dtl-test', HealthCheckCLI.ADDON_TYPE, help='Verify that all VDisks their DTL is properly running', short_help='Test if DTL is properly running') def check_dtl(result_handler): @@ -151,7 +151,7 @@ def _check_volumedriver_remove(vpool_name, vdisk_name, present=True): return True @staticmethod - # @expose_to_cli(MODULE, 'volumedrivers-test', HealthcheckCLI.ADDON_TYPE, + # @expose_to_cli(MODULE, 'volumedrivers-test', HealthCheckCLI.ADDON_TYPE, # help='Verify that the Volumedrivers are responding to events', # short_help='Test if Volumedrivers are responding to events') def check_volumedrivers(result_handler): @@ -222,7 +222,7 @@ def _is_volumedriver_timeout(cls, exception): return isinstance(exception, ClusterNotReachableException) or isinstance(exception, RuntimeError) and 'failed to send XMLRPC request' in str(exception) @classmethod - @expose_to_cli(MODULE, 'halted-volumes-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'halted-volumes-test', HealthCheckCLI.ADDON_TYPE, help='Verify that there are no halted/fenced volumes within the cluster', short_help='Test if there are no halted/fenced volumes') def check_for_halted_volumes(cls, result_handler): @@ -389,7 +389,7 @@ def _check_filedriver_remove(vp_name): return not os.path.exists('/mnt/{0}/ovs-healthcheck-test-*.xml'.format(vp_name)) @staticmethod - # @expose_to_cli(MODULE, 'filedrivers-test', HealthcheckCLI.ADDON_TYPE, + # @expose_to_cli(MODULE, 'filedrivers-test', HealthCheckCLI.ADDON_TYPE, # help='Verify that all Volumedrivers are accessible through FUSE', # short_help='Test if that the FUSE layer is responding') # @todo replace fuse test with edge test @@ -427,7 +427,7 @@ def check_filedrivers(result_handler): result_handler.failure('Filedriver of vPool {0} seems to have `input/output` problems'.format(vp.name)) @staticmethod - @expose_to_cli(MODULE, 'volume-potential-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'volume-potential-test', HealthCheckCLI.ADDON_TYPE, help='Verify that the Volumedrivers have enough VDisk potential left', short_help='Test if the Volumedrivers can create enough VDisks') @expose_to_cli.option('--critical-vol-number', type=int, default=25, help='Minimum number of volumes left to create') @@ -461,7 +461,7 @@ def check_volume_potential(result_handler, critical_vol_number=25): result_handler.exception('Unable to retrieve configuration for storagedriver {0}'.format(std.storagedriver_id)) @staticmethod - @expose_to_cli(MODULE, 'sco-cache-mountpoint-test', HealthcheckCLI.ADDON_TYPE, + @expose_to_cli(MODULE, 'sco-cache-mountpoint-test', HealthCheckCLI.ADDON_TYPE, help='Verify that sco-cache mountpoints are up and running', short_help='Test if sco-cache mountpoints are up and running') def check_sco_cache_mountpoints(result_handler): diff --git a/ovs/extensions/healthcheck/testing/__init__.py b/ovs/extensions/healthcheck/unittest/__init__.py similarity index 100% rename from ovs/extensions/healthcheck/testing/__init__.py rename to ovs/extensions/healthcheck/unittest/__init__.py diff --git a/ovs/extensions/healthcheck/testing/alba.py b/ovs/extensions/healthcheck/unittest/alba.py similarity index 100% rename from ovs/extensions/healthcheck/testing/alba.py rename to ovs/extensions/healthcheck/unittest/alba.py diff --git a/ovs/extensions/healthcheck/testing/cache.py b/ovs/extensions/healthcheck/unittest/cache.py similarity index 100% rename from ovs/extensions/healthcheck/testing/cache.py rename to ovs/extensions/healthcheck/unittest/cache.py diff --git a/ovs/extensions/healthcheck/testing/decorators.py b/ovs/extensions/healthcheck/unittest/decorators.py similarity index 100% rename from ovs/extensions/healthcheck/testing/decorators.py rename to ovs/extensions/healthcheck/unittest/decorators.py diff --git a/packaging/debian/debian/openvstorage-health-check.postinst b/packaging/debian/debian/openvstorage-health-check.postinst index 0cc4364..b312801 100644 --- a/packaging/debian/debian/openvstorage-health-check.postinst +++ b/packaging/debian/debian/openvstorage-health-check.postinst @@ -9,4 +9,4 @@ chmod 755 /opt/OpenvStorage/scripts/healthcheck_cli.py chmod +x /opt/OpenvStorage/scripts/healthcheck_cli.py # Clear the cache -python -c "from ovs.extensions.healthcheck.expose_to_cli import HealthcheckCLI; HealthcheckCLI.clear_cache()" \ No newline at end of file +python -c "from ovs.extensions.healthcheck.expose_to_cli import HealthCheckCLI; HealthCheckCLI.clear_cache()" \ No newline at end of file