-
Notifications
You must be signed in to change notification settings - Fork 10
Example: NVMe oF Target Creation Tear Down
Cayton edited this page Aug 29, 2019
·
1 revision
Prerequisite: Load modules (configfs, nvme, nvmet, nvmet_rdma) on NVMe-oF Target with an RDMA adapter up with an address of 192.168.11.11
Summary: to configure and enable an Exported Logical NVM Subsystem, restrict access to specific Hosts and grant a specific Host access
- Create an Exported Logical NVM Subsystem
- Configure an Exported Logical Namespace (create an Exported Logical Namespace ID, associate it with an Underlying Namespace ID, and enable the Exported Logical Namespace).
- Note: In this example the Exported Logical NVM Subsystem is restricted so ‘attr_allow_any_host’ is set to 0
- Configure the Exported Logical Port (create an Exported Logical Port associate it with an Underlying Port, and assign a Transport Service ID and optional attributes)
- Link the Exported Logical Port and the Exported Logical NVM Subsystem
- Add an entry to the Known Host List
- Grant Host Access by linking an entry from the Known Host List to the Exported Logical NVM Subsystem’s ‘allowed hosts’
-
Create the Exported Logical NVM Subsystem
mkdir /sys/kernel/config/nvmet/subsystems/subsys1
-
Configure the Exported Logical Namespace
mkdir /sys/kernel/config/nvmet/subsystems/subsys1/namespaces/1 echo -n /dev/nvme0n1 > /sys/kernel/config/nvmet/subsystems/subsys1/namespaces/1/device_path echo -n 0 > /sys/kernel/config/nvmet/subsystems/subsys1/attr_allow_any_host echo -n 1 > /sys/kernel/config/nvmet/subsystems/subsys1/namespaces/1/enable
-
Configure the Exported Logical Port
mkdir /sys/kernel/config/nvmet/ports/9 echo -n 192.168.11.11 > /sys/kernel/config/nvmet/ports/9/addr_traddr echo -n ipv4 > /sys/kernel/config/nvmet/ports/9/addr_adrfam echo -n rdma > /sys/kernel/config/nvmet/ports/9/addr_trtype echo -n not required >/sys/kernel/config/nvmet/ports/9/addr_treq echo -n 4420 > /sys/kernel/config/nvmet/ports/9/addr_trsvcid
-
Link the Exported Logical Port and Exported Logical NVM Subsystem
ln -s /sys/kernel/config/nvmet/subsystems/subsys1 /sys/kernel/config/nvmet/ports/9/subsystems/subsys1
-
Add a Known Host List Entry
mkdir /sys/kernel/config/nvmet/hosts/h1_nqn
-
Grant Host Access to this Exported Logical NVM Subsystem
ln –s /sys/kernel/config/nvmet/hosts/h1_nqn /sys/kernel/config/nvmet/subsystems/subsys1/allowed_hosts/h1_nqn
Summary: To tear down an Exported Logical NVM Subsystem: (Provided it is not connected by any host/initaiator)*
- Revoke Host Access to the Exported Logical NVM Subsystem
- Optional: Remove the Known Host List Entry, provided the Host NQN to be removed is:
- not granted access to ANY Exported Logical NVM Subsystems on this Target
- not going to be used to grant access to any Exported Logical Subsystems on this Target
- Unlink the Exported Logical Port from the Exported Logical NVM Subsystem
- Delete the Exported Logical Port
- Delete the Exported Logical Namespace
- Delete the Exported Logical NVM Subsystem
-
Revoke Host Access to the Exported Logical NVM Subsystem
rm /sys/kernel/config/nvmet/subsystems/subsys1/allowed_hosts/h1_nqn
-
Remove the Known Host List Entry
rmdir /sys/kernel/config/nvmet/hosts/h1_nqn
-
Unlink Exported Logical Port and Exported Logical NVM Subsystem
rm /sys/kernel/config/nvmet/ports/9/subsystems/subsys1
-
Delete the Exported Logical Port
rmdir /sys/kernel/config/nvmet/ports/9
-
Delete the Exported Logical Namespace
echo -n 0 > /sys/kernel/config/nvmet/subsystems/subsys1/namespaces/1/enable rmdir /sys/kernel/config/nvmet/subsystems/subsys1/namespaces/1
-
Delete the Exported Logical NVM Subsystem
rmdir /sys/kernel/config/nvmet/subsystems/subsys1