Skip to content

Commit 21493e3

Browse files
committed
New NVMeOf CLI
Fixes #151 Signed-off-by: Gil Bregman <gbregman@il.ibm.com>
1 parent 90b60ba commit 21493e3

20 files changed

+4188
-1304
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Globals
2-
VERSION="0.0.6"
2+
VERSION="0.0.7"
33
CEPH_VERSION="18.2.1"
44
SPDK_VERSION="23.01.1"
55
CONTAINER_REGISTRY="quay.io/ceph"

.github/workflows/build-container.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
strategy:
6666
fail-fast: false
6767
matrix:
68-
test: ["cli", "state", "multi_gateway", "server", "grpc", "omap_lock"]
68+
test: ["cli", "state", "multi_gateway", "server", "grpc", "omap_lock", "old_omap"]
6969
runs-on: ubuntu-latest
7070
env:
7171
HUGEPAGES: 512 # for multi gateway test, approx 256 per gateway instance
@@ -223,13 +223,29 @@ jobs:
223223
run: |
224224
make demo OPTS=-T NVMEOF_CONTAINER_NAME="ceph-nvmeof_nvmeof_1"
225225
226-
- name: Get subsystems
226+
- name: List resources
227227
run: |
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+
subs=$(cephnvmf --output stdio --format json subsystem list | grep nqn | sed 's/"nqn": "//' | sed 's/",$//')
233+
for sub in $subs
234+
do
235+
cephnvmf namespace list --subsystem $sub
236+
cephnvmf listener list --subsystem $sub
237+
cephnvmf host list --subsystem $sub
238+
done
239+
240+
- name: Verify no HA
241+
run: |
242+
shopt -s expand_aliases
243+
eval $(make alias)
244+
ha_status=$(cephnvmf --output stdio --format json subsystem list | grep "enable_ha" | grep "true" | tr -d '\n\r')
245+
if [ -n "$ha_status" ]; then
246+
echo "Found a subsystem with HA enabled, failing"
247+
exit 1
248+
fi
233249
234250
- name: Run bdevperf
235251
run: |
@@ -390,21 +406,20 @@ jobs:
390406
391407
gw1=$(container_ip $GW1)
392408
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
409+
cli_gw $gw1 subsystem list
410+
cli_gw $gw1 subsystem add --subsystem $NQN --serial $SERIAL
411+
cli_gw $gw1 namespace add --subsystem $NQN --rbd-pool $RBD_POOL --rbd-image $RBD_IMAGE_NAME
397412
for gw in $GW1 $GW2; do
398413
ip=$(container_ip $gw)
399414
name=$(container_id $gw) # default hostname - container id
400415
echo ℹ️ Create listener address $ip gateway $name
401-
cli_gw $ip create_listener --subnqn $NQN --gateway-name $name --traddr $ip --trsvcid $NVMEOF_IO_PORT
416+
cli_gw $ip listener add --subsystem $NQN --gateway-name $name --traddr $ip --trsvcid $NVMEOF_IO_PORT
402417
done
403-
cli_gw $gw1 add_host --subnqn $NQN --host "*"
418+
cli_gw $gw1 host add --subsystem $NQN --host "*"
404419
for gw in $GW1 $GW2; do
405420
ip=$(container_ip $gw)
406421
echo ℹ️ Subsystems for name $gw ip $ip
407-
cli_gw $ip get_subsystems
422+
cli_gw $ip subsystem list
408423
done
409424
410425
- 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)