Managing Ceph Block Device namespaces
Ceph Block Device namespaces provide logical isolation for block device images within a pool. A namespace enables isolation of images for different applications, tenants, or workloads without requiring separate pools.
Before you begin
- Ensure that the target pool exists.
- Ensure that you have appropriate permissions to manage Ceph Block Device resources.
- Ensure that the Ceph cluster is accessible from the command-line interface.
About this task
Each namespace exists within a pool and is referenced as part of the image specification. You can create, list, remove, and use namespaces to organize Ceph Block Device images within a pool.
Using namespaces provides the following benefits:
- Logical separation of images within a pool.
- Improved organization of resources.
- Multi-tenant isolation within the same pool.
- Simplified management of large numbers of images.
An image-spec can be identified by using the following syntax:
[POOL_NAME/[NAMESPACE/]]IMAGE
Where,
- The default for POOL_NAME is
rbd - The default for NAMESPACE is "". When no namespace is specified, the image resides in the default namespace.
Creating a namespace
Create a new namespace within an existing pool to logically isolate block device images for specific applications or tenants.
Procedure
rbd namespace create POOL_NAME/NAMESPACE
For example,
[root@rbd-client ~]# rbd namespace create mypool/dev
What to do next
rbd namespace list POOL_NAME
Removing a namespace
Delete a namespace from a pool when it is no longer needed. The namespace must be empty before removal.
Procedure
What to do next
Verify that the namespace is removed.
rbd namespace list POOL_NAME
The namespace will no longer be listed in the output.
Using namespaces in Ceph Block Device operations
Use a namespace to scope Ceph Block Device commands to a specific group of images within a pool, either by including the namespace in the image path or by using the --namespace option.
About this task
Both methods are functionally equivalent. When using these commands:
- Always specify both the pool and the namespace to avoid ambiguity.
- Use the --namespace option when scripting or when you want to separate the namespace from the image path.
Procedure
-
Specify the namespace in the image path.
rbd create POOL_NAME/NAMESPACE/IMAGE --size SIZEFor example,
[root@rbd-client ~]# rbd create mypool/dev/myimage --size 10240
This command creates the image
myimagein thedevnamespace within themypoolpool. -
Use the --namespace option.
rbd --namespace NAMESPACE -p POOL_NAME create IMAGE --size SIZEFor example,
[root@rbd-client ~]# rbd --namespace dev -p mypool create myimage --size 10240
This command creates the image
myimagein thedevnamespace within themypoolpool.