]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/cephadm: query iSCSI gateway FQDN from inside the container 69214/head
authorKefu Chai <k.chai@proxmox.com>
Mon, 1 Jun 2026 10:40:06 +0000 (18:40 +0800)
committerKefu Chai <k.chai@proxmox.com>
Mon, 1 Jun 2026 10:40:51 +0000 (18:40 +0800)
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 <k.chai@proxmox.com>
qa/workunits/cephadm/test_iscsi_setup.sh

index 88f379918bcaa262b7852b699e638e11a841c18f..38b5bcdd575481d8e1f47808657e250e0f98321d 100755 (executable)
@@ -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"