From 4e79844f07c5cfbd149e4a4fab873aa4519dfd86 Mon Sep 17 00:00:00 2001 From: Gil Bregman Date: Tue, 5 Nov 2024 15:21:21 +0200 Subject: [PATCH] Allow any address for listeners using address 0.0.0.0 (or :: for IPv6). Fixes #935 Signed-off-by: Gil Bregman --- mk/demo.mk | 2 ++ spdk | 2 +- tests/ha/demo_test.sh | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/mk/demo.mk b/mk/demo.mk index 2d9a3769..d18b07c7 100644 --- a/mk/demo.mk +++ b/mk/demo.mk @@ -1,12 +1,14 @@ ## Demo: HOSTNQN=`cat /etc/nvme/hostnqn` +NVMEOF_IO_PORT2=`expr $(NVMEOF_IO_PORT) + 1` # demo demo: $(NVMEOF_CLI) subsystem add --subsystem $(NQN) --no-group-append $(NVMEOF_CLI) namespace add --subsystem $(NQN) --rbd-pool $(RBD_POOL) --rbd-image $(RBD_IMAGE_NAME) --size $(RBD_IMAGE_SIZE) --rbd-create-image $(NVMEOF_CLI) namespace add --subsystem $(NQN) --rbd-pool $(RBD_POOL) --rbd-image $(RBD_IMAGE_NAME)2 --size $(RBD_IMAGE_SIZE) --rbd-create-image --no-auto-visible $(NVMEOF_CLI) listener add --subsystem $(NQN) --host-name `docker ps -q -f name=$(NVMEOF_CONTAINER_NAME)` --traddr $(NVMEOF_IP_ADDRESS) --trsvcid $(NVMEOF_IO_PORT) + $(NVMEOF_CLI) listener add --subsystem $(NQN) --host-name `docker ps -q -f name=$(NVMEOF_CONTAINER_NAME)` --traddr 0.0.0.0 --trsvcid $(NVMEOF_IO_PORT2) $(NVMEOF_CLI_IPV6) listener add --subsystem $(NQN) --host-name `docker ps -q -f name=$(NVMEOF_CONTAINER_NAME)` --traddr $(NVMEOF_IPV6_ADDRESS) --trsvcid $(NVMEOF_IO_PORT) --adrfam IPV6 $(NVMEOF_CLI) host add --subsystem $(NQN) --host-nqn "*" $(NVMEOF_CLI) namespace add_host --subsystem $(NQN) --nsid 2 --host-nqn $(HOSTNQN) diff --git a/spdk b/spdk index c2c28068..ef5d1aeb 160000 --- a/spdk +++ b/spdk @@ -1 +1 @@ -Subproject commit c2c2806866626f37faff8273cf656a0e05afc23a +Subproject commit ef5d1aebfedc30965e5c416da00015d73ad3bf62 diff --git a/tests/ha/demo_test.sh b/tests/ha/demo_test.sh index a656889e..208f185b 100755 --- a/tests/ha/demo_test.sh +++ b/tests/ha/demo_test.sh @@ -7,7 +7,7 @@ function cephnvmf_func() function demo_test_unsecured() { - make demo OPTS=-T + make demo OPTS=-T NVMEOF_IO_PORT2=${port2} return $? } @@ -125,8 +125,39 @@ function demo_bdevperf_unsecured() [[ `echo $conns | jq -r '.connections[0].use_dhchap'` == "false" ]] [[ `echo $conns | jq -r '.connections[1]'` == "null" ]] - echo "ℹ️ bdevperf detach controller" + echo "ℹ️ bdevperf tcp connect ip: $NVMEOF_IP_ADDRESS port: ${port2} nqn: $NQN, using any host listener" + localhostnqn=`cat /etc/nvme/hostnqn` + devs=`make exec -s SVC=bdevperf OPTS=-T CMD="$rpc -v -s $BDEVPERF_SOCKET bdev_nvme_attach_controller -b Nvme1 -t tcp -a $NVMEOF_IP_ADDRESS -s ${port2} -f ipv4 -n $NQN -q $localhostnqn -l -1 -o 10"` + + echo "ℹ️ verify connection list" + conns=$(cephnvmf_func --output stdio --format json connection list --subsystem $NQN) + [[ `echo $conns | jq -r '.status'` == "0" ]] + [[ `echo $conns | jq -r '.subsystem_nqn'` == "${NQN}" ]] + [[ `echo $conns | jq -r '.connections[0].nqn'` == "${localhostnqn}" ]] + [[ `echo $conns | jq -r '.connections[0].trsvcid'` == "${NVMEOF_IO_PORT}" ]] + [[ `echo $conns | jq -r '.connections[0].traddr'` == "${NVMEOF_IP_ADDRESS}" ]] + [[ `echo $conns | jq -r '.connections[0].adrfam'` == "ipv4" ]] + [[ `echo $conns | jq -r '.connections[0].trtype'` == "TCP" ]] + [[ `echo $conns | jq -r '.connections[0].connected'` == "true" ]] + [[ `echo $conns | jq -r '.connections[0].qpairs_count'` == "1" ]] + [[ `echo $conns | jq -r '.connections[0].secure'` == "false" ]] + [[ `echo $conns | jq -r '.connections[0].use_psk'` == "false" ]] + [[ `echo $conns | jq -r '.connections[0].use_dhchap'` == "false" ]] + [[ `echo $conns | jq -r '.connections[1].nqn'` == "${localhostnqn}" ]] + [[ `echo $conns | jq -r '.connections[1].trsvcid'` == "${port2}" ]] + [[ `echo $conns | jq -r '.connections[1].traddr'` == "${NVMEOF_IP_ADDRESS}" ]] + [[ `echo $conns | jq -r '.connections[1].adrfam'` == "ipv4" ]] + [[ `echo $conns | jq -r '.connections[1].trtype'` == "TCP" ]] + [[ `echo $conns | jq -r '.connections[1].connected'` == "true" ]] + [[ `echo $conns | jq -r '.connections[1].qpairs_count'` == "1" ]] + [[ `echo $conns | jq -r '.connections[1].secure'` == "false" ]] + [[ `echo $conns | jq -r '.connections[1].use_psk'` == "false" ]] + [[ `echo $conns | jq -r '.connections[1].use_dhchap'` == "false" ]] + [[ `echo $conns | jq -r '.connections[2]'` == "null" ]] + + echo "ℹ️ bdevperf detach controllers" make exec SVC=bdevperf OPTS=-T CMD="$rpc -v -s $BDEVPERF_SOCKET bdev_nvme_detach_controller Nvme0" + make exec SVC=bdevperf OPTS=-T CMD="$rpc -v -s $BDEVPERF_SOCKET bdev_nvme_detach_controller Nvme1" echo "ℹ️ bdevperf tcp connect ip: $NVMEOF_IPV6_ADDRESS port: $NVMEOF_IO_PORT nqn: $NQN, using IPv6" make exec -s SVC=bdevperf OPTS=-T CMD="$rpc -v -s $BDEVPERF_SOCKET bdev_nvme_attach_controller -b Nvme1 -t tcp -a $NVMEOF_IPV6_ADDRESS -s $NVMEOF_IO_PORT -f ipv6 -n $NQN -q $localhostnqn -l -1 -o 10"