there are 2 issues
1. in cephadm, i was always using the first daemon to populate the group
in all the services for the dashboard config.
2. in the API, if there are more than 1 gateways listed in the config,
rather than chosing a random gateway from the group, raise an
exception and warn user to specify the gw_group parameter in the api
request
Fixes: https://tracker.ceph.com/issues/68463
Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit
f9b50b2e88ae5d9ac4f2cab986527a0a12317da9)
Conflicts:
src/pybind/mgr/cephadm/services/nvmeof.py
gateways = json.loads(out)['gateways']
cmd_dicts = []
- spec = cast(NvmeofServiceSpec,
- self.mgr.spec_store.all_specs.get(daemon_descrs[0].service_name(), None))
-
for dd in daemon_descrs:
assert dd.hostname is not None
+ spec = cast(NvmeofServiceSpec,
+ self.mgr.spec_store.all_specs.get(dd.service_name(), None))
service_name = dd.service_name()
if not spec:
def _get_default_service(gateways):
if gateways:
- service_name = list(gateways.keys())[0]
+ gateway_keys = list(gateways.keys())
+ # if there are more than 1 gateway, rather than chosing a random gateway
+ # from any of the group, raise an exception to make it clear that we need
+ # to specify the group name in the API request.
+ if len(gateway_keys) > 1:
+ raise DashboardException(
+ msg=(
+ "Multiple NVMe-oF gateway groups are configured. "
+ "Please specify the 'gw_group' parameter in the request."
+ ),
+ component="nvmeof"
+ )
+ service_name = gateway_keys[0]
return service_name, gateways[service_name][0]['service_url']
return None