From: Zack Cerza Date: Thu, 1 Feb 2024 00:28:59 +0000 (-0700) Subject: Remove nuke: Trivial changes X-Git-Tag: 1.2.0~46^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5d45d1c9a7a12c9e61caddf432eb6d5302929e67;p=teuthology.git Remove nuke: Trivial changes This commit contains trivial changes like reference removals, docs changes, and removal of dead code. Signed-off-by: Zack Cerza --- diff --git a/docs/COMPONENTS.rst b/docs/COMPONENTS.rst index 3b9ee2c737..f4fe7fd8b7 100644 --- a/docs/COMPONENTS.rst +++ b/docs/COMPONENTS.rst @@ -52,11 +52,10 @@ nodes if they are available, and invokes ``teuthology-dispatcher`` in ``supervisor`` mode. ``supervisor`` reimages the target machines and invokes ``teuthology`` (the command). ``teuthology`` proceeds to execute the job (execute every task in the YAML job description). After the execution is -completed (ie ``teuthology`` process exits), ``supervisor`` unlocks or nukes -the target machines depending on the status of the job. If the requested -machines are not available, the ``dispatcher`` waits for the machines to be -available before running anymore jobs. Results from the job are stored in the -archive directory of the worker for forensic analysis. +completed (ie ``teuthology`` process exits), ``supervisor`` unlocks the +target machines. If the requested machines are not available, the ``dispatcher`` +waits for the machines to be available before running anymore jobs. Results from +the job are stored in the archive directory of the worker for forensic analysis. Since `QA suites `__ usually specify ``install`` and ``ceph`` tasks, we briefly describe what they do. When diff --git a/docs/README.rst b/docs/README.rst index 58b03f0c17..62f5ce0077 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -34,7 +34,6 @@ Provided Utilities * :ref:`teuthology-lock` - Lock, unlock, and update status of machines * :ref:`teuthology-ls` - List job results by examining an archive directory * :ref:`teuthology-openstack` - Use OpenStack backend (wrapper around ``teuthology-suite``) -* :ref:`teuthology-nuke` - Attempt to return a machine to a pristine state * :ref:`teuthology-queue` - List, or delete, jobs in the queue * :ref:`teuthology-report` - Submit test results to a web service (we use `paddles `__) * :ref:`teuthology-results` - Examing a finished run and email results diff --git a/docs/detailed_test_config.rst b/docs/detailed_test_config.rst index f97334b9f0..2a46c4d775 100644 --- a/docs/detailed_test_config.rst +++ b/docs/detailed_test_config.rst @@ -222,12 +222,6 @@ new tasks in this directory. Many of these tasks are used to run python scripts that are defined in the ceph/ceph-qa-suite. -If machines were locked as part of the run (with the --lock switch), -teuthology normally leaves them locked when there is any task failure -for investigation of the machine state. When developing new teuthology -tasks, sometimes this behavior is not useful. The ``unlock_on_failure`` -global option can be set to true to make the unlocking happen unconditionally. - Troubleshooting =============== diff --git a/setup.cfg b/setup.cfg index be35d5ebdd..a2e14b1d24 100644 --- a/setup.cfg +++ b/setup.cfg @@ -67,7 +67,6 @@ scripts = console_scripts = teuthology = scripts.run:main teuthology-openstack = scripts.openstack:main - teuthology-nuke = scripts.nuke:main teuthology-suite = scripts.suite:main teuthology-ls = scripts.ls:main teuthology-worker = scripts.worker:main diff --git a/teuthology/misc.py b/teuthology/misc.py index c03be7e856..a1b3cf6819 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -22,6 +22,8 @@ from types import MappingProxyType from tarfile import ReadError +from typing import Optional + from teuthology.util.compat import urljoin, urlopen, HTTPError from netaddr.strategy.ipv4 import valid_str as _is_ipv4 @@ -50,7 +52,7 @@ def host_shortname(hostname): else: return hostname.split('.', 1)[0] -def canonicalize_hostname(hostname, user='ubuntu'): +def canonicalize_hostname(hostname, user: Optional[str] ='ubuntu'): hostname_expr = hostname_expr_templ.format( lab_domain=config.lab_domain.replace('.', r'\.')) match = re.match(hostname_expr, hostname) @@ -108,20 +110,6 @@ def config_file(string): return config_dict -class MergeConfig(argparse.Action): - """ - Used by scripts to mergeg configurations. (nuke, run, and - schedule, for example) - """ - def __call__(self, parser, namespace, values, option_string=None): - """ - Perform merges of all the day in the config dictionaries. - """ - config_dict = getattr(namespace, self.dest) - for new in values: - deep_merge(config_dict, new) - - def merge_configs(config_paths): """ Takes one or many paths to yaml config files and merges them together, returning the result. diff --git a/teuthology/openstack/openstack-teuthology.cron b/teuthology/openstack/openstack-teuthology.cron index ee919bf7e9..835e1dcb48 100644 --- a/teuthology/openstack/openstack-teuthology.cron +++ b/teuthology/openstack/openstack-teuthology.cron @@ -1,2 +1 @@ SHELL=/bin/bash -*/30 * * * * ( date ; source $HOME/openrc.sh ; time timeout 900 $HOME/teuthology/virtualenv/bin/teuthology-nuke --stale-openstack ) >> $HOME/cron.log 2>&1 diff --git a/teuthology/openstack/test/openstack-integration.py b/teuthology/openstack/test/openstack-integration.py index c4eb7aaf66..5d1a266f60 100644 --- a/teuthology/openstack/test/openstack-integration.py +++ b/teuthology/openstack/test/openstack-integration.py @@ -33,7 +33,6 @@ import teuthology.lock import teuthology.lock.cli import teuthology.lock.query import teuthology.lock.util -import teuthology.nuke import teuthology.misc import teuthology.schedule import teuthology.suite @@ -136,20 +135,6 @@ class TestSuite(Integration): ssh = '' assert 'teuthology.log' in teuthology.misc.sh(ssh + " rsync -av " + upload) - def test_suite_nuke(self): - cwd = os.getcwd() - args = ['--suite', 'nuke', - '--suite-dir', cwd + '/teuthology/openstack/test', - '--machine-type', 'openstack', - '--verbose'] - logging.info("TestSuite:test_suite_nuke") - scripts.suite.main(args) - self.wait_worker() - log = self.get_teuthology_log() - assert "teuthology.run:FAIL" in log - locks = teuthology.lock.query.list_locks(locked=True) - assert len(locks) == 0 - class TestSchedule(Integration): def setup_method(self): @@ -256,31 +241,3 @@ class TestLock(Integration): out, err = capsys.readouterr() assert 'machine_type' in out assert 'openstack' in out - -class TestNuke(Integration): - - def setup_method(self): - self.options = ['--verbose', - '--machine-type', 'openstack'] - - def test_nuke(self): - image = next(iter(teuthology.openstack.OpenStack.image2url.keys())) - - (os_type, os_version, arch) = image.split('-') - args = scripts.lock.parse_args(self.options + - ['--lock-many', '1', - '--os-type', os_type, - '--os-version', os_version]) - assert teuthology.lock.cli.main(args) == 0 - locks = teuthology.lock.query.list_locks(locked=True) - logging.info('list_locks = ' + str(locks)) - assert len(locks) == 1 - ctx = argparse.Namespace(name=None, - config={ - 'targets': { locks[0]['name']: None }, - }, - owner=locks[0]['locked_by'], - teuthology_config={}) - teuthology.nuke.nuke(ctx, should_unlock=True) - locks = teuthology.lock.query.list_locks(locked=True) - assert len(locks) == 0 diff --git a/teuthology/run.py b/teuthology/run.py index e065495cff..8ac6b7b58c 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -8,7 +8,6 @@ from teuthology import install_except_hook from teuthology import report from teuthology.job_status import get_status from teuthology.misc import get_user, merge_configs -from teuthology.nuke import nuke from teuthology.run_tasks import run_tasks from teuthology.repo_utils import fetch_qa_suite from teuthology.results import email_results @@ -266,10 +265,6 @@ def report_outcome(config, archive, summary, fake_ctx): status = get_status(summary) passed = status == 'pass' - if not passed and bool(config.get('nuke-on-error')): - # only unlock if we locked them in the first place - nuke(fake_ctx, fake_ctx.lock) - if archive is not None: with open(os.path.join(archive, 'summary.yaml'), 'w') as f: yaml.safe_dump(summary, f, default_flow_style=False) diff --git a/teuthology/suite/placeholder.py b/teuthology/suite/placeholder.py index cc95e6e606..3a17751170 100644 --- a/teuthology/suite/placeholder.py +++ b/teuthology/suite/placeholder.py @@ -51,7 +51,6 @@ dict_templ = { 'archive_upload': Placeholder('archive_upload'), 'archive_upload_key': Placeholder('archive_upload_key'), 'machine_type': Placeholder('machine_type'), - 'nuke-on-error': True, 'os_type': Placeholder('distro'), 'os_version': Placeholder('distro_version'), 'overrides': { diff --git a/teuthology/task/internal/__init__.py b/teuthology/task/internal/__init__.py index 8fc442d6aa..b9bb0baf85 100644 --- a/teuthology/task/internal/__init__.py +++ b/teuthology/task/internal/__init__.py @@ -272,7 +272,7 @@ def check_ceph_data(ctx, config): try: proc.wait() except run.CommandFailedError: - log.error('Host %s has stale /var/lib/ceph, check lock and nuke/cleanup.', proc.remote.shortname) + log.error('Host %s has stale /var/lib/ceph!', proc.remote.shortname) failed = True if failed: raise RuntimeError('Stale /var/lib/ceph detected, aborting.') diff --git a/teuthology/test/test_run.py b/teuthology/test/test_run.py index 7a452f6872..c176c8f653 100644 --- a/teuthology/test/test_run.py +++ b/teuthology/test/test_run.py @@ -126,22 +126,20 @@ class TestRun(object): assert result == "/some/other/suite/path/qa" @patch("teuthology.run.get_status") - @patch("teuthology.run.nuke") @patch("yaml.safe_dump") @patch("teuthology.report.try_push_job_info") @patch("teuthology.run.email_results") @patch("teuthology.run.open") @patch("sys.exit") - def test_report_outcome(self, m_sys_exit, m_open, m_email_results, m_try_push_job_info, m_safe_dump, m_nuke, m_get_status): + def test_report_outcome(self, m_sys_exit, m_open, m_email_results, m_try_push_job_info, m_safe_dump, m_get_status): m_get_status.return_value = "fail" fake_ctx = Mock() summary = {"failure_reason": "reasons"} summary_dump = "failure_reason: reasons\n" - config = {"nuke-on-error": True, "email-on-error": True} - config_dump = "nuke-on-error: true\nemail-on-error: true\n" + config = {"email-on-error": True} + config_dump = "email-on-error: true\n" m_safe_dump.side_effect = [None, summary_dump, config_dump] run.report_outcome(config, "the/archive/path", summary, fake_ctx) - assert m_nuke.called m_try_push_job_info.assert_called_with(config, summary) m_open.assert_called_with("the/archive/path/summary.yaml", "w") assert m_email_results.called