Allow user to override Ceph cluster name

Add --cluster (default 'ceph') option to the
'openstack overcloud ceph deploy' command.
Whatever string is passed via this option will
be used to override the tripleo_cephadm_cluster
variable when the cli-deployed-ceph.yaml playboook
is called.

Closes-Bug: #1966559
Depends-On: I4daab327c0bdac2bcc569cc1d8d629c648ddf292
Change-Id: I07dfbd819e57f26cc4798b0d58ffacb3ba73fdb2
This commit is contained in:
John Fulton 2022-03-26 16:54:34 -04:00
parent 1cc380a268
commit ebe72e7056
2 changed files with 19 additions and 0 deletions

View File

@ -68,6 +68,7 @@ class TestOvercloudCephDeploy(fakes.FakePlaybookExecution):
"stack_name": 'overcloud',
"tripleo_cephadm_standalone": False,
'tripleo_cephadm_ssh_user': 'jimmy',
'tripleo_cephadm_cluster': 'ceph',
'tripleo_cephadm_first_mon_ip': '127.0.0.1',
'tripleo_roles_path': mock.ANY,
'tripleo_cephadm_container_ns': 'quay.io/ceph',
@ -112,6 +113,7 @@ class TestOvercloudCephDeploy(fakes.FakePlaybookExecution):
"tripleo_cephadm_standalone": False,
'tripleo_roles_path': mock.ANY,
'tripleo_cephadm_first_mon_ip': '127.0.0.1',
'tripleo_cephadm_cluster': 'ceph',
'dynamic_ceph_spec': False,
'ceph_spec_path': mock.ANY,
'tripleo_cephadm_container_ns': 'quay.io/ceph',

View File

@ -161,6 +161,19 @@ class OvercloudCephDeploy(command.Command):
"used for the Ceph cluster_network. "
"Defaults to 'storage_mgmt'."),
default='storage_mgmt')
parser.add_argument('--cluster',
help=_(
"Name of the Ceph cluster. "
"If set to 'foo', then the files "
"/etc/ceph/<FSID>/foo.conf and "
"/etc/ceph/<FSID>/foo.client.admin.keyring "
"will be created. Otherwise these "
"files will use the name 'ceph'. "
"Changing this means changing command line "
"calls too, e.g. 'ceph health' will become "
"'ceph --cluster foo health' unless export "
"CEPH_ARGS='--cluster foo' is used."),
default='ceph')
parser.add_argument('--mon-ip',
help=_(
"IP address of the first Ceph monitor. "
@ -375,6 +388,10 @@ class OvercloudCephDeploy(command.Command):
parsed_args.cluster_network_name)
extra_vars = {**extra_vars, **ceph_networks_map}
if parsed_args.cluster:
extra_vars['tripleo_cephadm_cluster'] = \
parsed_args.cluster
if parsed_args.mon_ip:
if not oooutils.is_valid_ip(parsed_args.mon_ip):
raise oscexc.CommandError(