Add --mon-ip option to deployed ceph

Add --mon-ip option to 'openstack overcloud
ceph deploy', to easily override the variable
tripleo_cephadm_first_mon_ip from the CLI.

This option makes deployed ceph easier when
using standalone.

Change-Id: Id9a61356e8fd4618ce68faa2677f4ed30981b7d6
This commit is contained in:
John Fulton 2021-12-21 17:04:50 +00:00
parent 294e42f599
commit 2ac3953410
2 changed files with 19 additions and 0 deletions

View File

@ -44,6 +44,7 @@ class TestOvercloudCephDeploy(fakes.FakePlaybookExecution):
arglist = ['deployed-metal.yaml', '--yes',
'--stack', 'overcloud',
'--skip-user-create',
'--mon-ip', '127.0.0.1',
'--cephadm-ssh-user', 'jimmy',
'--output', 'deployed-ceph.yaml',
'--container-namespace', 'quay.io/ceph',
@ -65,6 +66,7 @@ class TestOvercloudCephDeploy(fakes.FakePlaybookExecution):
"working_dir": mock.ANY,
"stack_name": 'overcloud',
'tripleo_cephadm_ssh_user': 'jimmy',
'tripleo_cephadm_first_mon_ip': '127.0.0.1',
'tripleo_roles_path': mock.ANY,
'tripleo_cephadm_container_ns': 'quay.io/ceph',
'tripleo_cephadm_container_image': 'ceph',

View File

@ -146,6 +146,14 @@ class OvercloudCephDeploy(command.Command):
"used for the Ceph cluster_network. "
"Defaults to 'storage_mgmt'."),
default='storage_mgmt')
parser.add_argument('--mon-ip',
help=_(
"IP address of the first Ceph monitor. "
"If not set, an IP from the Ceph "
"public_network of a server with the "
"mon label from the Ceph spec is used. "
"IP must already be active on server."),
default='')
parser.add_argument('--config',
help=_(
"Path to an existing ceph.conf with settings "
@ -301,6 +309,15 @@ class OvercloudCephDeploy(command.Command):
parsed_args.cluster_network_name)
extra_vars = {**extra_vars, **ceph_networks_map}
if parsed_args.mon_ip:
if not oooutils.is_valid_ip(parsed_args.mon_ip):
raise oscexc.CommandError(
"Invalid IP address '%s' passed to --mon-ip."
% parsed_args.mon_ip)
else:
extra_vars['tripleo_cephadm_first_mon_ip'] = \
parsed_args.mon_ip
if parsed_args.ceph_spec:
if not os.path.exists(parsed_args.ceph_spec):
raise oscexc.CommandError(