From a54ceeb6a16eee2597af0159c7dbfefe8b6a5937 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 8 Mar 2021 09:49:14 -0500 Subject: [PATCH] python-common: continue to allow RGWSpec(realm=r,zone=z) This is for backward compatibility: an octopus spec yaml can still be applied to an existing cluster. Note that it might not work on a new cluster, since cephadm no longer tries to create the realm or zone if they don't exist. Signed-off-by: Sage Weil (cherry picked from commit cca7391f54b724730ea091669627731bc74f3519) --- src/pybind/mgr/cephadm/tests/test_cephadm.py | 1 + src/python-common/ceph/deployment/service_spec.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index 8db49b269ba1a..9c1a7b7db07c3 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -702,6 +702,7 @@ class TestCephadm(object): (ServiceSpec('alertmanager'), CephadmOrchestrator.add_alertmanager), (ServiceSpec('rbd-mirror'), CephadmOrchestrator.add_rbd_mirror), (ServiceSpec('mds', service_id='fsname'), CephadmOrchestrator.add_mds), + (RGWSpec(rgw_realm='realm', rgw_zone='zone'), CephadmOrchestrator.add_rgw), (RGWSpec(service_id="foo"), CephadmOrchestrator.add_rgw), (ServiceSpec('cephadm-exporter'), CephadmOrchestrator.add_cephadm_exporter), ] diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index d619bb5478959..bc54a7fd51b9f 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -667,6 +667,11 @@ class RGWSpec(ServiceSpec): subcluster: Optional[str] = None, # legacy, only for from_json on upgrade ): assert service_type == 'rgw', service_type + + # for backward compatibility with octopus spec files, + if not service_id and (rgw_realm and rgw_zone): + service_id = rgw_realm + '.' + rgw_zone + super(RGWSpec, self).__init__( 'rgw', service_id=service_id, placement=placement, unmanaged=unmanaged, -- 2.39.5