Fix Ceph Stray host(s)/daemon(s) issue

During deployed ceph, spec is created with short hostnames and it is
applied to create all the ceph deamons on respective hosts.

In this stage if TLS is configured, hostnames are modified to
canonical names (fqdn), which results in stray ceph host(s)/daemon(s).

This patch adds the new option '--tld' to 'openstack overcloud ceph spec'
and 'openstack overcloud ceph deploy' commands.

When tld is passed to 'ceph_spec_bootstrap' module, ceph spec generation
is done with updated hostnames.
Also the hostnames are updated based on the tld passed.

Resolves: rhbz#2173101
Change-Id: Ib67785adcdd12892ff9038c21a3582746930b400
This commit is contained in:
Manoj Katari 2023-03-21 08:19:59 -04:00
parent 4d8fe985e0
commit e9c7306809
1 changed files with 43 additions and 0 deletions

View File

@ -291,6 +291,11 @@ class OvercloudCephDeploy(command.Command):
"Path to an existing crush hierarchy spec "
"file. "),
default=None)
parser.add_argument('--tld',
help=_(
"postfix added to the hostname to represent "
"canonical hostname "),
default=None)
parser.add_argument('--standalone', default=False,
action='store_true',
help=_("Use single host Ansible inventory. "
@ -485,6 +490,10 @@ class OvercloudCephDeploy(command.Command):
else:
extra_vars['crush_hierarchy_path'] = \
os.path.abspath(parsed_args.crush_hierarchy)
if parsed_args.tld:
extra_vars['tld_option'] = str(parsed_args.tld)
if parsed_args.ceph_vip:
if not os.path.exists(parsed_args.ceph_vip):
raise oscexc.CommandError(
@ -684,6 +693,19 @@ class OvercloudCephDeploy(command.Command):
"is not setting push_destination. Or "
"--skip-container-registry-config was used.")
if tld:
#call playbook to update hostname with tld
with oooutils.TempDirs() as tmp:
oooutils.run_ansible_playbook(
playbook='ceph-set-hostname.yaml',
inventory=inventory,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=oooutils.playbook_verbosity(self=self),
extra_vars=extra_vars,
reproduce_command=False,
)
# call playbook to deploy ceph
with oooutils.TempDirs() as tmp:
oooutils.run_ansible_playbook(
@ -1027,6 +1049,11 @@ class OvercloudCephSpec(command.Command):
"Path to an existing crush hierarchy spec "
"file. "),
default=None)
parser.add_argument('--tld',
help=_(
"postfix added to the hostname to represent "
"canonical hostname "),
default=None)
return parser
def take_action(self, parsed_args):
@ -1127,6 +1154,9 @@ class OvercloudCephSpec(command.Command):
extra_vars['crush_hierarchy_path'] = \
os.path.abspath(parsed_args.crush_hierarchy)
if parsed_args.tld:
extra_vars['tld_option'] = str(parsed_args.tld)
if parsed_args.standalone:
spec_playbook = 'cli-standalone-ceph-spec.yaml'
tags = ''
@ -1134,6 +1164,19 @@ class OvercloudCephSpec(command.Command):
spec_playbook = 'cli-deployed-ceph.yaml'
tags = 'ceph_spec'
if parsed_args.tld:
#call playbook to update hostname with tld
with oooutils.TempDirs() as tmp:
oooutils.run_ansible_playbook(
playbook='ceph-set-hostname.yaml',
inventory=inventory,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=oooutils.playbook_verbosity(self=self),
extra_vars=extra_vars,
reproduce_command=False,
)
with oooutils.TempDirs() as tmp:
oooutils.run_ansible_playbook(
playbook=spec_playbook,