class CephFSStorageProvider(_StrEnum):
KERNEL_MOUNT = 'kcephfs'
SAMBA_VFS = 'samba-vfs'
+ SAMBA_VFS_CLASSIC = 'samba-vfs/classic'
+ SAMBA_VFS_NEW = 'samba-vfs/new'
+
+ def expand(self) -> 'CephFSStorageProvider':
+ """Expand abbreviated/default values into the full/expanded form."""
+ if self == self.SAMBA_VFS:
+ # mypy gets confused by enums
+ return self.__class__(self.SAMBA_VFS_NEW)
+ return self
+
+ def is_vfs(self) -> bool:
+ """Return true if value is a samba vfs provider."""
+ return self in {
+ self.SAMBA_VFS,
+ self.SAMBA_VFS_CLASSIC,
+ self.SAMBA_VFS_NEW,
+ }
class SubSystem(_StrEnum):
share: resources.Share, resolver: PathResolver, cephx_entity: str
) -> Dict[str, Dict[str, str]]:
assert share.cephfs is not None
- assert share.cephfs.provider == CephFSStorageProvider.SAMBA_VFS
+ assert share.cephfs.provider.is_vfs(), "not a vfs provider"
assert cephx_entity, "cephx entity name missing"
# very annoyingly, samba's ceph module absolutely must NOT have the
# "client." bit in front. JJM has been tripped up by this multiple times -
share.cephfs.subvolume,
share.cephfs.path,
)
+ try:
+ ceph_vfs = {
+ CephFSStorageProvider.SAMBA_VFS_CLASSIC: 'ceph',
+ CephFSStorageProvider.SAMBA_VFS_NEW: 'ceph_new',
+ }[share.checked_cephfs.provider.expand()]
+ except KeyError:
+ raise ValueError(
+ f'unsupported provider: {share.checked_cephfs.provider}'
+ )
cfg = {
# smb.conf options
'options': {
'path': path,
- "vfs objects": "acl_xattr ceph",
+ "vfs objects": f"acl_xattr {ceph_vfs}",
'acl_xattr:security_acl_name': 'user.NTACL',
- 'ceph:config_file': '/etc/ceph/ceph.conf',
- 'ceph:filesystem': share.cephfs.volume,
- 'ceph:user_id': cephx_entity,
+ f'{ceph_vfs}:config_file': '/etc/ceph/ceph.conf',
+ f'{ceph_vfs}:filesystem': share.cephfs.volume,
+ f'{ceph_vfs}:user_id': cephx_entity,
'read only': ynbool(share.readonly),
'browseable': ynbool(share.browseable),
'kernel share modes': 'no',
'browseable': 'Yes',
'kernel share modes': 'no',
'x:ceph:id': 'foo.s1',
- 'vfs objects': 'acl_xattr ceph',
+ 'vfs objects': 'acl_xattr ceph_new',
'acl_xattr:security_acl_name': 'user.NTACL',
- 'ceph:config_file': '/etc/ceph/ceph.conf',
- 'ceph:filesystem': 'cephfs',
- 'ceph:user_id': 'smb.fs.cluster.foo',
+ 'ceph_new:config_file': '/etc/ceph/ceph.conf',
+ 'ceph_new:filesystem': 'cephfs',
+ 'ceph_new:user_id': 'smb.fs.cluster.foo',
},
},
'Ess Two': {
'browseable': 'Yes',
'kernel share modes': 'no',
'x:ceph:id': 'foo.stwo',
- 'vfs objects': 'acl_xattr ceph',
+ 'vfs objects': 'acl_xattr ceph_new',
'acl_xattr:security_acl_name': 'user.NTACL',
- 'ceph:config_file': '/etc/ceph/ceph.conf',
- 'ceph:filesystem': 'cephfs',
- 'ceph:user_id': 'smb.fs.cluster.foo',
+ 'ceph_new:config_file': '/etc/ceph/ceph.conf',
+ 'ceph_new:filesystem': 'cephfs',
+ 'ceph_new:user_id': 'smb.fs.cluster.foo',
},
},
},