Skip to content

Commit

Permalink
Add middleware backend support for SMB fast copy (#14663)
Browse files Browse the repository at this point in the history
Enable SMB parameters required for support of VEEAM fast copy if
TrueNAS is enterprise-licensed.
  • Loading branch information
anodos325 authored Oct 11, 2024
1 parent e01b813 commit 02ed20e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/middlewared/middlewared/plugins/smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ def generate_smb_configuration(self):
smb_config = self.middleware.call_sync('smb.config')
smb_shares = self.middleware.call_sync('sharing.smb.query')
bind_ip_choices = self.middleware.call_sync('smb.bindip_choices')
is_enterprise = self.middleware.call_sync('system.is_enterprise')

return generate_smb_conf_dict(
ds_type, ds_config, smb_config, smb_shares, bind_ip_choices, idmap_config
ds_type, ds_config, smb_config, smb_shares, bind_ip_choices, idmap_config, is_enterprise
)

@private
Expand Down Expand Up @@ -1200,7 +1201,9 @@ async def validate_aux_params(self, data, schema_name):
'socket options',
'include',
'wide links',
'insecure wide links'
'insecure wide links',
'zfs_core:zfs_block_cloning',
'zfs_core:zfs_integrity_streams',
]
freebsd_vfs_objects = [
'noacl',
Expand Down
7 changes: 6 additions & 1 deletion src/middlewared/middlewared/plugins/smb_/util_smbconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def generate_smb_conf_dict(
smb_service_config: dict,
smb_shares: list,
smb_bind_choices: dict,
idmap_settings: list
idmap_settings: list,
is_enterprise: bool = False
):
guest_enabled = any(filter_list(smb_shares, [['guestok', '=', True]]))
fsrvp_enabled = any(filter_list(smb_shares, [['fsrvp', '=', True]]))
Expand Down Expand Up @@ -303,7 +304,11 @@ def generate_smb_conf_dict(
param, value = entry.split('=', 1)
smbconf[param.strip()] = value.strip()

# The following parameters must come after processing includes in order to
# prevent auxiliary parameters from overriding them
smbconf.update({
'zfs_core:zfs_integrity_streams': is_enterprise,
'zfs_core:zfs_block_cloning': is_enterprise,
'registry shares': True,
'include': 'registry',
})
Expand Down
11 changes: 11 additions & 0 deletions src/middlewared/middlewared/pytest/unit/plugins/test_smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ def test__base_smb():
assert conf['server smb encrypt'] == 'default'
assert conf['directory mask'] == '0775'
assert conf['create mask'] == '0664'
assert conf['zfs_core:zfs_integrity_streams'] is False
assert conf['zfs_core:zfs_block_cloning'] is False


def test__base_smb_enterprise():
conf = generate_smb_conf_dict(
None, None, BASE_SMB_CONFIG, [],
BIND_IP_CHOICES, BASE_IDMAP, True
)
assert conf['zfs_core:zfs_integrity_streams'] is True
assert conf['zfs_core:zfs_block_cloning'] is True


def test__syslog():
Expand Down

0 comments on commit 02ed20e

Please sign in to comment.