diff --git a/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py b/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py index 827eb9224..51e614979 100644 --- a/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py +++ b/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py @@ -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', diff --git a/tripleoclient/v2/overcloud_ceph.py b/tripleoclient/v2/overcloud_ceph.py index 7cbcaf28f..365b0bce8 100644 --- a/tripleoclient/v2/overcloud_ceph.py +++ b/tripleoclient/v2/overcloud_ceph.py @@ -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(