From f1a9a36dbc525a14c556f088b4e63d2e6531fa76 Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Tue, 11 Oct 2022 12:06:21 +0200 Subject: [PATCH] Addressing some of Ali comments Signed-off-by: Redouane Kachach (cherry picked from commit 83b0ef406df3a22dccf36c9e9bd2c75c6f20ebd4) --- doc/cephadm/services/rgw.rst | 6 +++--- doc/mgr/rgw.rst | 4 +--- src/pybind/mgr/rgw/module.py | 2 +- src/python-common/ceph/deployment/service_spec.py | 5 +++++ src/python-common/ceph/rgw/rgwam_core.py | 7 +++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/cephadm/services/rgw.rst b/doc/cephadm/services/rgw.rst index e9aee3c6b7fc6..2c1c06261f48f 100644 --- a/doc/cephadm/services/rgw.rst +++ b/doc/cephadm/services/rgw.rst @@ -91,15 +91,15 @@ you can use :ref:`mgr-rgw-module` or manually using something like: .. prompt:: bash # - radosgw-admin realm create --rgw-realm= --default + radosgw-admin realm create --rgw-realm= .. prompt:: bash # - radosgw-admin zonegroup create --rgw-zonegroup= --master --default + radosgw-admin zonegroup create --rgw-zonegroup= --master .. prompt:: bash # - radosgw-admin zone create --rgw-zonegroup= --rgw-zone= --master --default + radosgw-admin zone create --rgw-zonegroup= --rgw-zone= --master .. prompt:: bash # diff --git a/doc/mgr/rgw.rst b/doc/mgr/rgw.rst index 97624fcac62f5..7e4d814e95d50 100644 --- a/doc/mgr/rgw.rst +++ b/doc/mgr/rgw.rst @@ -85,8 +85,6 @@ Following is an example of zone spec file: .. code-block:: yaml - rgw_realm: myrealm - rgw_zonegroup: myzonegroup rgw_zone: my-secondary-zone rgw_realm_token: placement: @@ -124,7 +122,7 @@ List the tokens of all the available realms ceph rgw zone create -i spec.yaml -Create a new zone and join existing realm (using the realm token) +Join an existing realm by creating a new secondary zone (using the realm token) :: diff --git a/src/pybind/mgr/rgw/module.py b/src/pybind/mgr/rgw/module.py index e47b9b5a83b61..b6ff1bbaae814 100644 --- a/src/pybind/mgr/rgw/module.py +++ b/src/pybind/mgr/rgw/module.py @@ -236,7 +236,7 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): placement: Optional[str] = None, start_radosgw: Optional[bool] = True, inbuf: Optional[str] = None): - """Bootstrap new rgw zone that syncs with existing zone""" + """Bootstrap new rgw zone that syncs with zone on another cluster in the same realm""" if inbuf: rgw_specs = self._parse_rgw_specs(inbuf) diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index 68f149aae7a97..5f31b38694b04 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -934,6 +934,11 @@ class RGWSpec(ServiceSpec): if self.rgw_zone and not self.rgw_realm: raise SpecValidationError( 'Cannot add RGW: Zone specified but no realm specified') + if not (self.rgw_realm and not self.rgw_zonegroup): + if self.rgw_realm_token and not self.rgw_zone: + raise SpecValidationError('Cannot add RGW: Token specified but no zone specified') + elif self.rgw_zone and not self.rgw_realm_token: + raise SpecValidationError('Cannot add RGW: Zone specified but no token specified') yaml.add_representer(RGWSpec, ServiceSpec.yaml_representer) diff --git a/src/python-common/ceph/rgw/rgwam_core.py b/src/python-common/ceph/rgw/rgwam_core.py index 0f207b331be8a..8f1be630a3b80 100644 --- a/src/python-common/ceph/rgw/rgwam_core.py +++ b/src/python-common/ceph/rgw/rgwam_core.py @@ -210,7 +210,7 @@ class RealmOp: params = ['realm', 'create'] return RGWAdminJSONCmd(ze).run(params) - def pull(self, realm, url, access_key, secret, set_default=False): + def pull(self, realm, url, access_key, secret): params = ['realm', 'pull', '--url', url, @@ -637,7 +637,7 @@ class RGWAM: try: user_info = self.user_op().info(master_zone, master_zg, access_key=access_key) except RGWAMException as e: - raise RGWAMException('failed to create system user', e) + raise RGWAMException('failed to get the system user information', e) user = RGWUser(user_info) @@ -754,8 +754,7 @@ class RGWAM: secret = realm_token.secret try: realm_info = self.realm_op().pull(EntityName(realm_token.realm_name), - realm_token.endpoint, access_key, - secret, set_default=True) + realm_token.endpoint, access_key, secret) except RGWAMException as e: raise RGWAMException('failed to pull realm', e) -- 2.39.5