Deployed Ceph time synchronization
During 'openstack overcloud deploy ceph', there are chances for apply_spec operation to fail as the chronyd ntp service is down. Currently cephadm installs chronyd during bootstrap in command_prepare_host(). This patch will ensure that chronyd installation is done by tripleo by default with addition of below parameters. --skip-ntp allows user can skip ntp configuration --ntp-server accepts the list of ntp servers as a string --ntp-heat-env-file accepts the path to heat environment file which has the ntp servers configuration. Resolves: rhbz#2172063 Depends-On: I5d4a6a2f141582c18846057237b0858becc6dacd Change-Id: I85b692c21269f1bb69dabd54c1c2212cb03e2afe
This commit is contained in:
parent
b780e6d1fb
commit
d8670cec0e
@ -53,7 +53,7 @@ class TestOvercloudCephDeploy(fakes.FakePlaybookExecution):
|
||||
'--container-tag', 'latest']
|
||||
parsed_args = self.check_parser(self.cmd, arglist, [])
|
||||
self.cmd.take_action(parsed_args)
|
||||
mock_playbook.assert_called_once_with(
|
||||
mock_playbook.assert_called_with(
|
||||
playbook='cli-deployed-ceph.yaml',
|
||||
inventory=mock.ANY,
|
||||
workdir=mock.ANY,
|
||||
@ -100,7 +100,7 @@ class TestOvercloudCephDeploy(fakes.FakePlaybookExecution):
|
||||
'--container-tag', 'latest']
|
||||
parsed_args = self.check_parser(self.cmd, arglist, [])
|
||||
self.cmd.take_action(parsed_args)
|
||||
mock_playbook.assert_called_once_with(
|
||||
mock_playbook.assert_called_with(
|
||||
playbook='cli-deployed-ceph.yaml',
|
||||
inventory=mock.ANY,
|
||||
workdir=mock.ANY,
|
||||
|
@ -114,6 +114,12 @@ class OvercloudCephDeploy(command.Command):
|
||||
"deployed servers. By default this is "
|
||||
"configured so overcloud nodes can pull "
|
||||
"containers from the undercloud registry."))
|
||||
parser.add_argument('--skip-ntp', default=False,
|
||||
action='store_true',
|
||||
help=_("Do not install/enable NTP chronyd "
|
||||
"service. By default time synchronization "
|
||||
"service chronyd is installed and enabled "
|
||||
"later by tripleo."))
|
||||
parser = arg_parse_common(parser)
|
||||
parser.add_argument('--roles-data',
|
||||
help=_(
|
||||
@ -254,6 +260,18 @@ class OvercloudCephDeploy(command.Command):
|
||||
action='store_true',
|
||||
help=_("Adjust configuration defaults to suit "
|
||||
"a single-host Ceph cluster."))
|
||||
ntp_group = parser.add_mutually_exclusive_group()
|
||||
ntp_group.add_argument('--ntp-server',
|
||||
help=_("NTP Servers to be used while "
|
||||
"configuring chronyd service."
|
||||
"e.g. --ntp-server '0.pool.ntp.org,"
|
||||
"1.pool.ntp.org,2.pool.ntp.org'"))
|
||||
ntp_group.add_argument('--ntp-heat-env-file', default=None,
|
||||
help=_("Path to existing heat environment "
|
||||
"file with NTP servers to be used "
|
||||
"while configuring chronyd service."
|
||||
"NTP servers are extracted from "
|
||||
"'NtpServer' key"))
|
||||
spec_group = parser.add_mutually_exclusive_group()
|
||||
spec_group.add_argument('--ceph-spec',
|
||||
help=_(
|
||||
@ -654,6 +672,39 @@ class OvercloudCephDeploy(command.Command):
|
||||
"is not setting push_destination. Or "
|
||||
"--skip-container-registry-config was used.")
|
||||
|
||||
if not parsed_args.skip_ntp:
|
||||
ntpserver = ""
|
||||
ntp_extra_vars = {}
|
||||
if parsed_args.ntp_server:
|
||||
ntpserver = str(parsed_args.ntp_server)
|
||||
elif parsed_args.ntp_heat_env_file:
|
||||
with open(os.path.abspath(parsed_args.ntp_heat_env_file),
|
||||
'r') as f:
|
||||
ntp_vars_file = yaml.safe_load(f)
|
||||
ntpserver = \
|
||||
str(ntp_vars_file['parameter_defaults']['NtpServer'])
|
||||
|
||||
if ntpserver:
|
||||
ntp_extra_vars = {
|
||||
'chrony_ntp_servers':
|
||||
[item for item in ntpserver.split(',')]
|
||||
}
|
||||
|
||||
# call playbook to configure ntp chrony
|
||||
with oooutils.TempDirs() as tmp:
|
||||
oooutils.run_ansible_playbook(
|
||||
playbook='ceph-chrony.yaml',
|
||||
inventory=inventory,
|
||||
workdir=tmp,
|
||||
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
|
||||
verbosity=oooutils.playbook_verbosity(self=self),
|
||||
extra_vars=ntp_extra_vars,
|
||||
reproduce_command=False,
|
||||
)
|
||||
else:
|
||||
self.log.debug("Not installing NTP chrony service because "
|
||||
"--skip-ntp was used.")
|
||||
|
||||
# call playbook to deploy ceph
|
||||
with oooutils.TempDirs() as tmp:
|
||||
oooutils.run_ansible_playbook(
|
||||
|
Loading…
Reference in New Issue
Block a user