From ebe72e7056ddebdc8304bb18b1c9ba9ac82f0a77 Mon Sep 17 00:00:00 2001 From: John Fulton Date: Sat, 26 Mar 2022 16:54:34 -0400 Subject: [PATCH] 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 --- .../v2/overcloud_ceph/test_overcloud_ceph.py | 2 ++ tripleoclient/v2/overcloud_ceph.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py b/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py index c2fc3404a..048704b83 100644 --- a/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py +++ b/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py @@ -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', diff --git a/tripleoclient/v2/overcloud_ceph.py b/tripleoclient/v2/overcloud_ceph.py index 556b74050..c9a196042 100644 --- a/tripleoclient/v2/overcloud_ceph.py +++ b/tripleoclient/v2/overcloud_ceph.py @@ -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//foo.conf and " + "/etc/ceph//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(