Fix discovery duplicate

This commit is contained in:
Audiobuzz
2026-06-28 02:11:08 +00:00
parent 5e4ee87e88
commit b159bc678c
+6 -6
View File
@@ -33,7 +33,6 @@ RELEASES_DIR="${RELEASES_DIR:-/releases}"
TADDR="${TARGET_ADDR:-0.0.0.0}"
TPORT="${TARGET_PORT:-4420}"
SUBNQN_BASE="${SUBNQN_BASE:-nqn.2026-06.org.example.fleet:rootfs}"
DISCOVERY_NQN="nqn.2014-08.org.nvmexpress.discovery"
# Legacy fixed namespace UUIDs (pre per-version-UUID builds baked these into the
# UKI cmdline). Used as a fallback when verity.json lacks the per-version pair.
LEGACY_DATA_UUID="f1ee7000-0000-4000-8000-000000000001"
@@ -148,11 +147,12 @@ cmd_add() {
rpc nvmf_subsystem_add_ns "$nqn" "rootfs_$s" -u "$du"
rpc nvmf_subsystem_add_ns "$nqn" "roothash_$s" -u "$hu"
rpc nvmf_subsystem_add_listener "$nqn" -t tcp -a "$TADDR" -s "$TPORT"
# Ensure the discovery subsystem has this listener too. The target already
# registered it at startup, so this is normally a no-op that SPDK reports as
# "Listener already exists" — fully suppress stdout+stderr (rpc.py prints the
# JSON error to STDOUT, so 2>/dev/null alone wouldn't hide it).
rpc nvmf_subsystem_add_listener "$DISCOVERY_NQN" -t tcp -a "$TADDR" -s "$TPORT" >/dev/null 2>&1 || true
# NOTE: we deliberately do NOT (re)add the discovery-subsystem listener here.
# The long-lived target registers it ONCE at startup (spdk-target.sh), and a
# subsystem becomes discoverable simply by having its own listener on the same
# address. Re-adding it would make the nvmf_tgt DAEMON log "Listener already
# exists" to the container stdout on every add — noise the client can't
# suppress (the daemon, not rpc.py, emits it). One registration is enough.
echo "==> release $v ONLINE (existing connections untouched)"
}