Skip to content

Commit 287ff3b

Browse files
committed
mgr/dashboard: Allow adding all listeners unders a subsystems
Issue: - Currently a user cannot add all listeners under a subsystem - This results into an error: `Failure adding nqn.2001-07.com.ceph:1725013182540 listener at 10.70.44.140:4420: Gateway's host name must match current host (dhcp47-54)` Reason: - The gateway address used while creating listener is random now in nvmeof client - After checking the gateway logs of each node, its is found that no grpc request recieved for adding listener on the respective node rather going to the node that is chosen by default in nvmeof client. - But nvmeof backend check that current gateway matches the one with sent in request for adding listener (ref: https://github.com/ceph/ceph-nvmeof/blob/devel/control/grpc.py#L2104) Fix: - Using `traddr` from listener API to set the current gateway address - Since `traddr` gives only IP address, without port therefore extracting full address from `NvmeofGatewaysConfig.get_gateways_config()` - This ensures correct path usage Fixes https://tracker.ceph.com/issues/68229 Signed-off-by: Afreen Misbah <[email protected]>
1 parent 48d1517 commit 287ff3b

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/pybind/mgr/dashboard/controllers/nvmeof.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def create(
140140
trsvcid: int = 4420,
141141
adrfam: int = 0, # IPv4
142142
):
143-
return NVMeoFClient().stub.create_listener(
143+
return NVMeoFClient(traddr=traddr).stub.create_listener(
144144
NVMeoFClient.pb2.create_listener_req(
145145
nqn=nqn,
146146
host_name=host_name,

src/pybind/mgr/dashboard/services/nvmeof_client.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class NVMeoFClient(object):
2323
pb2 = pb2
2424

25-
def __init__(self, gw_group: Optional[str] = None):
25+
def __init__(self, gw_group: Optional[str] = None, traddr: Optional[str] = None):
2626
logger.info("Initiating nvmeof gateway connection...")
2727
try:
2828
if not gw_group:
@@ -36,6 +36,23 @@ def __init__(self, gw_group: Optional[str] = None):
3636
f'Unable to retrieve the gateway info: {e}'
3737
)
3838

39+
# While creating listener need to direct request to the gateway
40+
# address where listener is supposed to be added.
41+
if traddr:
42+
gateways_info = NvmeofGatewaysConfig.get_gateways_config()
43+
matched_gateway = next(
44+
(
45+
gateway
46+
for gateways in gateways_info['gateways'].values()
47+
for gateway in gateways
48+
if traddr in gateway['service_url']
49+
),
50+
None
51+
)
52+
if matched_gateway:
53+
self.gateway_addr = matched_gateway.get('service_url')
54+
logger.debug("Gateway address set to: %s", self.gateway_addr)
55+
3956
root_ca_cert = NvmeofGatewaysConfig.get_root_ca_cert(service_name)
4057
if root_ca_cert:
4158
client_key = NvmeofGatewaysConfig.get_client_key(service_name)

0 commit comments

Comments
 (0)