From 50ef945949219206ef2026b6b2f30b2a0c45c66e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 1 Jun 2026 18:40:06 +0800 Subject: [PATCH] qa/cephadm: query iSCSI gateway FQDN from inside the container rbd-target-api validates that the gateway hostname supplied by gwcli matches the container's own socket.getfqdn(). Running the same call on the host can return a different value when the host and container resolve names differently (e.g. on Rocky 10), causing gateway creation to fail with HTTP 400 and all subsequent gwcli configuration to break silently. Query the FQDN from inside the iSCSI container directly so the value is always consistent with what rbd-target-api expects. This also removes the "run twice" workaround, which was compensating for host-side DNS warm-up flakiness rather than addressing the underlying mismatch. Fixes: https://tracker.ceph.com/issues/74577 Signed-off-by: Kefu Chai --- qa/workunits/cephadm/test_iscsi_setup.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/qa/workunits/cephadm/test_iscsi_setup.sh b/qa/workunits/cephadm/test_iscsi_setup.sh index 88f379918bc..38b5bcdd575 100755 --- a/qa/workunits/cephadm/test_iscsi_setup.sh +++ b/qa/workunits/cephadm/test_iscsi_setup.sh @@ -27,14 +27,11 @@ ISCSI_DAEMON_NAME=$(sudo cephadm ls --no-detail | jq -r '.[] | select(.name | st ISCSI_DAEMON_ID=$(cut -d '.' -f2- <<< "$ISCSI_DAEMON_NAME") HOSTNAME=$(sudo cephadm shell -- ceph orch ps --daemon-id "$ISCSI_DAEMON_ID" -f json | jq -r '.[] | .hostname') NODE_IP=$(sudo cephadm shell -- ceph orch host ls --format json | jq --arg HOSTNAME "$HOSTNAME" -r '.[] | select(.hostname == $HOSTNAME) | .addr') -# The result of this python line is what iscsi will expect for the first gateway name -FQDN=$(python3 -c 'import socket; print(socket.getfqdn())') -# I am running this twice on purpose. I don't know why but in my testing the first time this would -# run it would return a different result then all subsequent runs (and take significantly longer to run). -# The result from the first run would cause gateway creation to fail when the return value is used -# later on. It was likely specific to my env, but it doesn't hurt to run it twice anyway. This -# was the case whether I ran it through cephadm shell or directly on the host machine. -FQDN=$(python3 -c 'import socket; print(socket.getfqdn())') +# Query the FQDN from inside the container: rbd-target-api validates that the +# gateway name matches the container's own hostname, so the value must come +# from the same environment to avoid mismatches on distros where the host and +# container resolve names differently. +FQDN=$(sudo podman exec ${ISCSI_CONT_ID} python3 -c 'import socket; print(socket.getfqdn())') ISCSI_POOL=$(sudo cephadm shell -- ceph orch ls iscsi --format json | jq -r '.[] | .spec | .pool') ISCSI_USER="adminadmin" ISCSI_PASSWORD="adminadminadmin" -- 2.47.3