Managing SMB shares by using declarative method
Learn to create, remove, modify, and list SMB shares by using declarative method.
Before you begin
- Gather information about the domain when using active-directory.
- Create a domain user to join to active directory (AD).
- Determine whether you need to use
custom_dnssetting - Know which users to define if you are not using AD.
About this task
This method uses the command ceph smb apply to process resource descriptions specified in YAML or JSON, similar to service specifications for Ceph orchestration with cephadm, by using SMB-specific resource types.
Creating SMB shares
About this task
Learn how to create the SMB shares by using the declarative method.
Procedure
resource_type: ceph.smb.share
The name parameter specifies the display name for SMB clients and corresponds to the --share-name flag in imperative commands. If omitted, the share_id is used as the share name.
Share name validation rules:
- Maximum 64 characters
- Must start with alphanumeric (a-z, A-Z, 0-9) or underscore (_)
- May contain alphanumeric, spaces, underscores (_), periods (.), hyphens (-)
- Pattern:
^[a-zA-Z0-9_][a-zA-Z0-9. _-]{,63}$
resource_type: ceph.smb.share cluster_id: tango share_id: sp1 name: "Staff Pics" cephfs: volume: cephfs path: /pics subvolumegroup: smbshares subvolume: staff
Modifying SMB shares
About this task
Learn how to modify the SMB shares by using the declarative method.
When you modify an SMB share, you do not create a new resource. Instead, you resubmit the existing resource definition with the same cluster_id and share_id values. The Ceph SMB module treats this submission as an update to the existing SMB share configuration.
Procedure
resource_type: ceph.smb.share cluster_id: tango share_id: sp1 name: "Staff Pics" cephfs: volume: cephfs path: /pics subvolumegroup: smbshares subvolume: staff
name and CephFS path values are updated:
resource_type: ceph.smb.share cluster_id: tango share_id: sp1 name: "Team Photos" cephfs: volume: cephfs path: /team-pics subvolumegroup: smbshares subvolume: staff
Apply the updated specification file:
ceph smb apply -i updated-share.yaml
The following changes are not supported when you update an existing SMB share:
- You cannot change the resource type. For example, a resource defined as
ceph.smb.sharecannot be changed to another resource type by using the same ID. - You cannot modify immutable identifiers such as
cluster_idandshare_id. - You cannot modify domain or join configuration after the resource is deployed.
Removing SMB shares
About this task
Learn how to remove the SMB shares by using the declarative method.
Procedure
intent: removed
resource_type: ceph.smb.share cluster_id: tango share_id: sp2 intent: removed