Skip to content

Commit 3092dcd

Browse files
committed
New NVMeOf CLI.
Fixes #151 Signed-off-by: Gil Bregman <gbregman@il.ibm.com>
1 parent 12d7e73 commit 3092dcd

File tree

13 files changed

+3097
-964
lines changed

13 files changed

+3097
-964
lines changed

.github/workflows/build-container.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ jobs:
228228
# https://github.com/actions/toolkit/issues/766
229229
shopt -s expand_aliases
230230
eval $(make alias)
231-
nvmeof-cli get_subsystems
232-
nvmeof-cli-ipv6 get_subsystems
231+
cephnvmf subsystem list
232+
cephnvmf-ipv6 subsystem list
233233
234234
- name: Run bdevperf
235235
run: |
@@ -390,21 +390,20 @@ jobs:
390390
391391
gw1=$(container_ip $GW1)
392392
echo ℹ️ Using GW RPC $GW1 address $gw1 port $NVMEOF_GW_PORT
393-
cli_gw $gw1 get_subsystems
394-
cli_gw $gw1 create_bdev --pool $RBD_POOL --image $RBD_IMAGE_NAME --bdev $BDEV_NAME
395-
cli_gw $gw1 create_subsystem --subnqn $NQN --serial $SERIAL
396-
cli_gw $gw1 add_namespace --subnqn $NQN --bdev $BDEV_NAME
393+
cli_gw $gw1 subsystem list
394+
cli_gw $gw1 subsystem add --subsystem $NQN --serial $SERIAL
395+
cli_gw $gw1 namespace add --subsystem $NQN --rbd-pool $RBD_POOL --rbd-image $RBD_IMAGE_NAME
397396
for gw in $GW1 $GW2; do
398397
ip=$(container_ip $gw)
399398
name=$(container_id $gw) # default hostname - container id
400399
echo ℹ️ Create listener address $ip gateway $name
401-
cli_gw $ip create_listener --subnqn $NQN --gateway-name $name --traddr $ip --trsvcid $NVMEOF_IO_PORT
400+
cli_gw $ip listener add --subsystem $NQN --gateway-name $name --traddr $ip --trsvcid $NVMEOF_IO_PORT
402401
done
403-
cli_gw $gw1 add_host --subnqn $NQN --host "*"
402+
cli_gw $gw1 host add --subsystem $NQN --host "*"
404403
for gw in $GW1 $GW2; do
405404
ip=$(container_ip $gw)
406405
echo ℹ️ Subsystems for name $gw ip $ip
407-
cli_gw $ip get_subsystems
406+
cli_gw $ip subsystem list
408407
done
409408
410409
- name: Run bdevperf discovery

Dockerfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ FROM quay.io/ceph/spdk:${NVMEOF_SPDK_VERSION:-NULL} AS base-gateway
1616
RUN \
1717
--mount=type=cache,target=/var/cache/dnf \
1818
--mount=type=cache,target=/var/lib/dnf \
19-
dnf install -y python3-rados
19+
dnf install -y python3-rados python3-pip
20+
RUN \
21+
--mount=type=cache,target=/root/.cache/pip \
22+
pip install -U pip setuptools
2023
ENTRYPOINT ["python3", "-m", "control"]
2124
CMD ["-c", "/src/ceph-nvmeof.conf"]
2225

@@ -99,6 +102,17 @@ LABEL io.ceph.component="$NVMEOF_NAME" \
99102

100103
ENV PYTHONPATH=$APPDIR/__pypackages__/$PYTHON_MAJOR.$PYTHON_MINOR/lib
101104

105+
RUN \
106+
--mount=type=cache,target=/var/cache/dnf \
107+
--mount=type=cache,target=/var/lib/dnf \
108+
dnf install -y python3-pip
109+
RUN \
110+
--mount=type=cache,target=/root/.cache/pip \
111+
TABULATE_INSTALL=lib-only pip install -U --target $APPDIR/__pypackages__/$PYTHON_MAJOR.$PYTHON_MINOR/lib tabulate
112+
RUN \
113+
--mount=type=cache,target=/root/.cache/pip \
114+
pip install -U --target $APPDIR/__pypackages__/$PYTHON_MAJOR.$PYTHON_MINOR/lib pyyaml
115+
102116
WORKDIR $APPDIR
103117

104118
#------------------------------------------------------------------------------

README.md

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -92,36 +92,25 @@ The following command executes all the steps required to set up the NVMe-oF envi
9292

9393
```bash
9494
$ make demo
95-
96-
DOCKER_BUILDKIT=1 docker-compose exec ceph-vstart-cluster bash -c "rbd info demo_image || rbd create demo_image --size 10M"
95+
docker-compose exec ceph bash -c "rbd -p rbd info demo_image || rbd -p rbd create demo_image --size 10M"
9796
rbd: error opening image demo_image: (2) No such file or directory
98-
99-
DOCKER_BUILDKIT=1 docker-compose run --rm ceph-nvmeof-cli --server-address ceph-nvmeof --server-port 5500 create_bdev --pool rbd --image demo_image --bdev demo_bdev
100-
Creating nvmeof_ceph-nvmeof-cli_run ... done
101-
INFO:__main__:Created bdev demo_bdev: True
102-
103-
DOCKER_BUILDKIT=1 docker-compose run --rm ceph-nvmeof-cli --server-address ceph-nvmeof --server-port 5500 create_subsystem --subnqn nqn.2016-06.io.spdk:cnode1 --serial SPDK00000000000001
104-
Creating nvmeof_ceph-nvmeof-cli_run ... done
105-
INFO:__main__:Created subsystem nqn.2016-06.io.spdk:cnode1: True
106-
107-
DOCKER_BUILDKIT=1 docker-compose run --rm ceph-nvmeof-cli --server-address ceph-nvmeof --server-port 5500 add_namespace --subnqn nqn.2016-06.io.spdk:cnode1 --bdev demo_bdev
108-
Creating nvmeof_ceph-nvmeof-cli_run ... done
109-
INFO:__main__:Added namespace 1 to nqn.2016-06.io.spdk:cnode1: True
110-
111-
DOCKER_BUILDKIT=1 docker-compose run --rm ceph-nvmeof-cli --server-address ceph-nvmeof --server-port 5500 create_listener --subnqn nqn.2016-06.io.spdk:cnode1 -g gateway_name -a gateway_addr -s 4420
112-
Creating nvmeof_ceph-nvmeof-cli_run ... done
113-
INFO:__main__:Created nqn.2016-06.io.spdk:cnode1 listener: True
114-
115-
DOCKER_BUILDKIT=1 docker-compose run --rm ceph-nvmeof-cli --server-address ceph-nvmeof --server-port 5500 add_host --subnqn nqn.2016-06.io.spdk:cnode1 --host "*"
116-
Creating nvmeof_ceph-nvmeof-cli_run ... done
117-
INFO:__main__:Allowed open host access to nqn.2016-06.io.spdk:cnode1: True
97+
docker-compose run --rm nvmeof-cli --server-address 192.168.13.3 --server-port 5500 subsystem add --subsystem "nqn.2016-06.io.spdk:cnode1" --ana-reporting --enable-ha
98+
Adding subsystem nqn.2016-06.io.spdk:cnode1: Successful
99+
docker-compose run --rm nvmeof-cli --server-address 192.168.13.3 --server-port 5500 namespace add --subsystem "nqn.2016-06.io.spdk:cnode1" --rbd-pool rbd --rbd-image demo_image
100+
Adding namespace 1 to nqn.2016-06.io.spdk:cnode1, load balancing group 1: Successful
101+
docker-compose run --rm nvmeof-cli --server-address 192.168.13.3 --server-port 5500 listener add --subsystem "nqn.2016-06.io.spdk:cnode1" --gateway-name fbca1a3d3ed8 --traddr 192.168.13.3 --trsvcid 4420
102+
Adding listener 192.168.13.3:4420 to nqn.2016-06.io.spdk:cnode1: Successful
103+
docker-compose run --rm nvmeof-cli --server-address 2001:db8::3 --server-port 5500 listener add --subsystem "nqn.2016-06.io.spdk:cnode1" --gateway-name fbca1a3d3ed8 --traddr 2001:db8::3 --trsvcid 4420 --adrfam IPV6
104+
Adding listener [2001:db8::3]:4420 to nqn.2016-06.io.spdk:cnode1: Successful
105+
docker-compose run --rm nvmeof-cli --server-address 192.168.13.3 --server-port 5500 host add --subsystem "nqn.2016-06.io.spdk:cnode1" --host "*"
106+
Allowing any host for nqn.2016-06.io.spdk:cnode1: Successful
118107
```
119108

120109
#### Manual Steps
121110

122111
The same configuration can also be manually run:
123112

124-
1. First of all, let's create the `nvmeof-cli` shortcut to interact with the NVMe-oF gateway:
113+
1. First of all, let's create the `cephnvmf` shortcut to interact with the NVMe-oF gateway:
125114
126115
```bash
127116
eval $(make alias)
@@ -133,34 +122,28 @@ The same configuration can also be manually run:
133122
make rbd
134123
```
135124
136-
1. Create a bdev (Block Device) from an RBD image:
137-
138-
```bash
139-
nvmeof-cli create_bdev --pool rbd --image demo_image --bdev demo_bdev
140-
```
141-
142125
1. Create a subsystem:
143126
144127
```bash
145-
nvmeof-cli create_subsystem --subnqn nqn.2016-06.io.spdk:cnode1 --serial SPDK00000000000001
128+
cephnvmf subsystem add --subsystem nqn.2016-06.io.spdk:cnode1
146129
```
147130
148131
1. Add a namespace:
149132
150133
```bash
151-
nvmeof-cli add_namespace --subnqn nqn.2016-06.io.spdk:cnode1 --bdev demo_bdev
134+
cephnvmf namespace add --subsystem nqn.2016-06.io.spdk:cnode1 --rbd-pool rbd --rbd-image demo_image
152135
```
153136
154137
1. Create a listener so that NVMe initiators can connect to:
155138
156139
```bash
157-
nvmeof-cli create_listener ---subnqn nqn.2016-06.io.spdk:cnode1 -g gateway_name -a gateway_addr -s 4420
140+
cephnvmf listener add ---subsystem nqn.2016-06.io.spdk:cnode1 -g gateway_name -a gateway_addr -s 4420
158141
```
159142
160143
1. Define which hosts can connect:
161144
162145
```bash
163-
nvmeof-cli add_host --subnqn nqn.2016-06.io.spdk:cnode1 --host "*"
146+
cephnvmf host add --subsystem nqn.2016-06.io.spdk:cnode1 --host "*"
164147
```
165148
166149

0 commit comments

Comments
 (0)