Managing masked namespaces
In some cases, namespaces require isolation on a per-volume basis including multi-tenancy and for other various security purposes. By default, all hosts with access to a subsystem can see all namespaces within the subsystem. Use this information to change the visibility of a specific namespace, as well as to add and remove hosts from a masked namespace, one that is not automatically visible.
Before you begin
About this task
- To create a namespace with a masked namespace, use the --no-auto-visible in the namespace add command.
- To change a host from no restrictions, to one with restrictive visibility, use the
--auto-visible nooption in the namespace change_visibility command.
Creating a namespace with restrictive visibility
ceph nvmeof namespace add --nqn NQN [--rbd_image_name IMAGE_NAME] [--rbd_pool POOL_NAME] [--create-image] [--size POOL_SIZE] [--rbd_image_size IMAGE_SIZE] --no-auto-visible
[root@host01 ~]# ceph nvmeof namespace add --nqn nqn.2016-06.io.spdk:cnode1.group1 --rbd_image_name image1 --rbd_pool pool1 --no-auto-visible Success
- --uuid
- block_size<int>
- --nsid
- --block_size<int>
- --size
- --create-image
- --force
Use the --force parameter to create a namespace even if its image is already used by another namespace.
- --rbd-trash-image-on-delete
Instructs the gateway to automatically delete the Ceph Block Device (RBD) image that is created for the namespace when the namespace is deleted.
- --force
Use the --force parameter to create a namespace even if its image is already used by another namespace.
This parameter only applies to Ceph Block Device images created when adding a namespace. If the namespace was added by using an existing Ceph Block Device image, this image will not be deleted with the namespace.Note: The --rbd-trash-image-on-delete parameter can only be used together with the --create-image parameter. - --read-only
Use to create a namespace that cannot be modified. Use read-only namespaces to prevent namespace changes during operations such as during disaster recovery tests. The Read-Only or Read-Write status can be seen in the namespace list output.Important: Once a namespace is flagged as read-only it cannot be modified to read-write.
Changing namespace visibility
auto-visible yes option. To mask a namespace, for a namespace to only be visible to specific hosts, use the auto-visible no option.
auto-visible yes to auto-visible no the command fails when there are previously connected hosts to the namespace unless the --force parameter is used.ceph nvmeof namespace change_visibility --nqn NQN --nsid NSID --auto-visible <yes|no> [--force] [gw_group GW_GROUP] [--server-address SERVER_ADDRESS]
Use no to enable namespace masking and yes to remove namespace masking.
- Example for enabling namespace masking
-
[root@host01 ~]# ceph nvmeof namespace change_visibility --nqn nqn.2016-06.io.spdk:cnode1.group1 --nsid 3 –-auto-visible no Success
- Example for removing namespace masking
-
[root@host01 ~]# ceph nvmeof namespace change_visibility --nqn nqn.2016-06.io.spdk:cnode1.group1 --nsid 3 –-auto-visible yes --force Success
Adding a host to a masked namespace
ceph nvmeof namespace add_host --nqn NQN --nsid NSID [--host_nqn HOST_NQN] [--force] [gw_group GW_GROUP] [--server-address SERVER_ADDRESS]
Multiple host NQNs can be added to the namespace.
--host-nqn HOST01_NQN HOST02_NQN
[root@host01 ~]# ceph nvmeof namespace add_host --nqn nqn.2016-06.io.spdk:cnode2.group3 --nsid 3 --host-nqn nqn.2014-08.org.nvmexpress:uuid:950ddadf-f995-47b7-9416-b9bb233f66e3 Success
Removing a host from a masked namespace
ceph nvmeof namespace del_host --nqn NQN --nsid NSID [--host_nqn HOST_NQN] [gw_group GW_GROUP] [--server-address SERVER_ADDRESS]
Multiple host NQNs can be removed from the namespace.
--host-nqn HOST01_NQN HOST02_NQN
[root@host01 ~]# ceph nvmeof namespace del_host --nqn nqn.2016-06.io.spdk:cnode2.group3 --nsid 3 --host-nqn nqn.2014-08.org.nvmexpress:uuid:950ddadf-f995-47b7-9416-b9bb233f66e3 Success