Skip to content

Commit 70ec6d4

Browse files
mgr/smb: add custom config options to share and cluster resources
Allow devs/testers/experimenters to add custom smb config params to our managed shares or clusters. Use at your own risk. Signed-off-by: John Mulligan <[email protected]>
1 parent fc21d00 commit 70ec6d4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/pybind/mgr/smb/resources.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class Share(_RBase):
134134
readonly: bool = False
135135
browseable: bool = True
136136
cephfs: Optional[CephFSStorage] = None
137+
custom_smb_share_options: Optional[Dict[str, str]] = None
137138

138139
def __post_init__(self) -> None:
139140
# if name is not given explicitly, take it from the share_id
@@ -153,6 +154,7 @@ def validate(self) -> None:
153154
# currently only cephfs is supported
154155
if self.cephfs is None:
155156
raise ValueError('a cephfs configuration is required')
157+
validation.check_custom_options(self.custom_smb_share_options)
156158

157159
@property
158160
def checked_cephfs(self) -> CephFSStorage:
@@ -165,6 +167,10 @@ def _customize_resource(rc: resourcelib.Resource) -> resourcelib.Resource:
165167
rc.on_construction_error(InvalidResourceError.wrap)
166168
return rc
167169

170+
@property
171+
def cleaned_custom_smb_share_options(self) -> Optional[Dict[str, str]]:
172+
return validation.clean_custom_options(self.custom_smb_share_options)
173+
168174

169175
@resourcelib.component()
170176
class JoinAuthValues(_RBase):
@@ -294,6 +300,7 @@ class Cluster(_RBase):
294300
domain_settings: Optional[DomainSettings] = None
295301
user_group_settings: Optional[List[UserGroupSource]] = None
296302
custom_dns: Optional[List[str]] = None
303+
custom_smb_global_options: Optional[Dict[str, str]] = None
297304
# embedded orchestration placement spec
298305
placement: Optional[WrappedPlacementSpec] = None
299306

@@ -321,13 +328,18 @@ def validate(self) -> None:
321328
raise ValueError(
322329
'domain settings not supported for user auth mode'
323330
)
331+
validation.check_custom_options(self.custom_smb_global_options)
324332

325333
@resourcelib.customize
326334
def _customize_resource(rc: resourcelib.Resource) -> resourcelib.Resource:
327335
rc.on_condition(_present)
328336
rc.on_construction_error(InvalidResourceError.wrap)
329337
return rc
330338

339+
@property
340+
def cleaned_custom_smb_global_options(self) -> Optional[Dict[str, str]]:
341+
return validation.clean_custom_options(self.custom_smb_global_options)
342+
331343

332344
@resourcelib.resource('ceph.smb.join.auth')
333345
class JoinAuth(_RBase):

0 commit comments

Comments
 (0)