chrony: cleanup during overcloud host upgrade

The Kolla Ansible chrony container is disabled by default in the Wallaby
release. A new kolla-ansible chrony-cleanup command can be used to clean
up the container.

This change extends the 'kayobe overcloud host upgrade' command to cover
cleaning up the chrony container (if disabled) and deploying a host
chrony daemon.

Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/792119

Change-Id: I275102ec6b5bab6982577b52fd29654c874446ce
This commit is contained in:
Mark Goddard 2021-05-19 19:47:36 +01:00
parent 211c68aa6c
commit dc53d29eaa
2 changed files with 36 additions and 2 deletions

View File

@ -1044,7 +1044,8 @@ class OvercloudHostCommandRun(KayobeAnsibleMixin, VaultMixin, Command):
extra_vars=extra_vars) extra_vars=extra_vars)
class OvercloudHostUpgrade(KayobeAnsibleMixin, VaultMixin, Command): class OvercloudHostUpgrade(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
Command):
"""Upgrade the overcloud host services. """Upgrade the overcloud host services.
Performs the changes necessary to make the host services suitable for the Performs the changes necessary to make the host services suitable for the
@ -1058,6 +1059,15 @@ class OvercloudHostUpgrade(KayobeAnsibleMixin, VaultMixin, Command):
"overcloud-docker-sdk-upgrade", "overcloud-etc-hosts-fixup") "overcloud-docker-sdk-upgrade", "overcloud-etc-hosts-fixup")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="overcloud") self.run_kayobe_playbooks(parsed_args, playbooks, limit="overcloud")
# TODO(mgoddard): Remove this in Y cycle after Kolla Ansible chrony
# container has been dropped for a cycle.
# NOTE(mgoddard): Clean up the chrony container if it exists, and
# deploy a host chrony daemon.
self.generate_kolla_ansible_config(parsed_args, service_config=False)
self.run_kolla_ansible_overcloud(parsed_args, "chrony-cleanup")
playbooks = _build_playbook_list("time")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="overcloud")
class OvercloudDatabaseBackup(KollaAnsibleMixin, KayobeAnsibleMixin, class OvercloudDatabaseBackup(KollaAnsibleMixin, KayobeAnsibleMixin,
VaultMixin, Command): VaultMixin, Command):

View File

@ -1192,7 +1192,9 @@ class TestCase(unittest.TestCase):
@mock.patch.object(commands.KayobeAnsibleMixin, @mock.patch.object(commands.KayobeAnsibleMixin,
"run_kayobe_playbooks") "run_kayobe_playbooks")
def test_overcloud_host_upgrade(self, mock_run): @mock.patch.object(commands.KollaAnsibleMixin,
"run_kolla_ansible_overcloud")
def test_overcloud_host_upgrade(self, mock_kolla_run, mock_run):
command = commands.OvercloudHostUpgrade(TestApp(), []) command = commands.OvercloudHostUpgrade(TestApp(), [])
parser = command.get_parser("test") parser = command.get_parser("test")
parsed_args = parser.parse_args([]) parsed_args = parser.parse_args([])
@ -1215,9 +1217,31 @@ class TestCase(unittest.TestCase):
], ],
limit="overcloud", limit="overcloud",
), ),
mock.call(
mock.ANY,
[utils.get_data_files_path("ansible", "kolla-ansible.yml")],
ignore_limit=True,
tags="config",
),
mock.call(
mock.ANY,
[
utils.get_data_files_path(
"ansible", "time.yml"),
],
limit="overcloud",
),
] ]
self.assertEqual(expected_calls, mock_run.call_args_list) self.assertEqual(expected_calls, mock_run.call_args_list)
expected_calls = [
mock.call(
mock.ANY,
"chrony-cleanup",
),
]
self.assertEqual(expected_calls, mock_kolla_run.call_args_list)
@mock.patch.object(commands.KollaAnsibleMixin, @mock.patch.object(commands.KollaAnsibleMixin,
"run_kolla_ansible_overcloud") "run_kolla_ansible_overcloud")
def test_overcloud_database_backup(self, mock_run): def test_overcloud_database_backup(self, mock_run):