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
...> 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.
...> 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
-------
+++ /dev/null
-{
- "hosts": [],
- "ports": [
- {
- "addr": {
- "adrfam": "ipv4",
- "traddr": "192.168.7.68",
- "treq": "not specified",
- "trsvcid": "1023",
- "trtype": "rdma"
- },
- "portid": 2,
- "subsystems": [
- "nqn.2014-08.org.nvmexpress:NVMf:uuid:77dca664-0d3e-4f67-b8b2-04c70e3f991d"
- ]
- }
- ],
- "subsystems": [
- {
- "allowed_hosts": [],
- "attr": {
- "allow_any_host": "1"
- },
- "namespaces": [
- {
- "device": {
- "nguid": "289ae029-c396-3143-87e8-aec0d7a4b1a8",
- "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"
- }
- ]
-}