Skip to content

Commit

Permalink
Allow any address for listeners using address 0.0.0.0 (or :: for IPv6).
Browse files Browse the repository at this point in the history
Fixes #935

Signed-off-by: Gil Bregman <[email protected]>
  • Loading branch information
gbregman committed Nov 5, 2024
1 parent 9d14790 commit 4e79844
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mk/demo.mk
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spdk
Submodule spdk updated 1 files
+12 −3 lib/nvme/nvme.c
35 changes: 33 additions & 2 deletions tests/ha/demo_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function cephnvmf_func()

function demo_test_unsecured()
{
make demo OPTS=-T
make demo OPTS=-T NVMEOF_IO_PORT2=${port2}
return $?
}

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 4e79844

Please sign in to comment.