Skip to content
Snippets Groups Projects
Commit c5b36ff0 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

update README and examples


Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 5ad1da24
No related branches found
No related tags found
No related merge requests found
......@@ -25,16 +25,13 @@ configfs is mounted on /sys/kernel/config, using:
mount -t configs none /sys/kernel/config
You can load the default config that exports the first NVMe device and
the first ramdisk by running "nvmetcli restore nvmet.json". The default
config is stored in /etc/nvmet.json. You can also edit the json file
directly.
To get started with the interactive mode start nvmetcli without
arguments. Then in the nvmetcli prompt type:
#
# Create a subsystem. If you do not specify a name a NQN will be generated.
# Create a subsystem. If you do not specify a name a NQN will be generated,
# which is probably the best choice, we we don't do it here as the name
# would be random
#
> cd /subsystems
......@@ -55,6 +52,20 @@ arguments. Then in the nvmetcli prompt type:
...> cd /subsystems/testnqn/
...> set attr allow_any_host=1
#
# Create a port through which access is allowed, and enable access to
# a subsystem through it.
#
# This creates a trivial loopback port that can be used with nvme-loop on
# the same machine:
#
...> cd /ports/
...> create 1
...> cd 1/
...> set addr trtype=loop
...> cd subsystems/
...> create testnqn
#
# Create a new namespace. If you do not specify a namespace ID the fist
# unused one will be used.
......@@ -63,9 +74,43 @@ arguments. Then in the nvmetcli prompt type:
...> cd namespaces
...> create 1
...> cd 1
...> set device path=/dev/ram1
...> set device path=/dev/nvme0n1
...> enable
#
# Or create a RDMA (IB, RoCE, iWarp) port using IPv4 addressing, 4420 is the
# IANA assigned port for NVMe over Fabrics using RDMA:
#
...> cd /ports/
...> create 2
...> cd 2/
...> set addr trtype=rdma
...> set addr adrfam=ipv4
...> set addr traddr=192.168.6.68
...> set addr trsvcid=4420
...> cd subsystems/
...> create testnqn
Saving and restoring the configuration
--------------------------------------
The saveconfig and restoreconfig commands inside nvmetcli save and restore
the current configuration, but you can also invoke these commands for the
command line using the load and restore arguments to nvmetcli. Without
an additional file name these operate on /etc/nvmet.json.
To load the loop + explicit host version above do the following:
./nvmetcli load loop.json
Or to load the rdma + no host authentication version do the following
after you've ensured that the IP address in rdma.json fits your setup:
./nvmetcli load rdma.json
You can also edit the json files directly.
Testing
-------
......
{
"hosts": [
{
"nqn": "hostnqn"
}
],
"ports": [
{
"addr": {
"adrfam": "",
"traddr": "",
"treq": "not specified",
"trsvcid": "",
"trtype": "loop"
},
"portid": 1,
"referrals": [],
"subsystems": [
"testnqn"
]
}
],
"subsystems": [
{
"allowed_hosts": [
"hostnqn"
],
"attr": {
"allow_any_host": "0"
},
"namespaces": [
{
"device": {
"nguid": "ef90689c-6c46-d44c-89c1-4067801309a8",
"path": "/dev/nvme0n1"
},
"enable": 1,
"nsid": 1
}
],
"nqn": "testnqn"
}
]
}
{
"hosts": [],
"hosts": [
{
"nqn": "hostnqn"
}
],
"ports": [
{
"addr": {
"adrfam": "ipv4",
"traddr": "192.168.7.68",
"traddr": "192.168.6.68",
"treq": "not specified",
"trsvcid": "1023",
"trsvcid": "4420",
"trtype": "rdma"
},
"portid": 2,
"referrals": [],
"subsystems": [
"nqn.2014-08.org.nvmexpress:NVMf:uuid:77dca664-0d3e-4f67-b8b2-04c70e3f991d"
"testnqn"
]
}
],
......@@ -24,22 +29,14 @@
"namespaces": [
{
"device": {
"nguid": "289ae029-c396-3143-87e8-aec0d7a4b1a8",
"nguid": "ef90689c-6c46-d44c-89c1-4067801309a8",
"path": "/dev/nvme0n1"
},
"enable": 1,
"nsid": 1
},
{
"device": {
"nguid": "8a6a2e57-1a2d-2b41-8938-bc409c4ebb6c",
"path": "/dev/ram0"
},
"enable": 0,
"nsid": 2
}
],
"nqn": "nqn.2014-08.org.nvmexpress:NVMf:uuid:77dca664-0d3e-4f67-b8b2-04c70e3f991d"
"nqn": "testnqn"
}
]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment