Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-122841 / 23.10 / Use 16K as default for volume block size #11638

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/middlewared/middlewared/plugins/pool_/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,12 @@ async def __common_validation(self, verrors, schema, data, mode, parent=None, cu
verrors.add(f'{schema}.recordsize', f'{rs!r} is an invalid recordsize.')

elif data['type'] == 'VOLUME':
if mode == 'CREATE' and 'volsize' not in data:
verrors.add(f'{schema}.volsize', 'This field is required for VOLUME')
if mode == 'CREATE':
if 'volsize' not in data:
verrors.add(f'{schema}.volsize', 'This field is required for VOLUME')
if 'volblocksize' not in data:
# with openzfs 2.2, zfs sets 16k as default https://github.com/openzfs/zfs/pull/12406
data['volblocksize'] = '16K'

for i in (
'aclmode', 'acltype', 'atime', 'casesensitivity', 'quota', 'refquota', 'recordsize',
Expand Down
2 changes: 1 addition & 1 deletion tests/api2/test_543_vm_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def data():


def test_01_vm_disk_choices(request):
with dataset('test zvol', {'type': 'VOLUME', 'volsize': 1024000}) as ds:
with dataset('test zvol', {'type': 'VOLUME', 'volsize': 1048576}) as ds:
results = GET('/vm/device/disk_choices')
assert isinstance(results.json(), dict), results.json()
assert results.json().get(f'/dev/zvol/{ds.replace(" ", "+")}') == f'{ds}'
Expand Down
6 changes: 3 additions & 3 deletions tests/api2/test_iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def iscsi_extent(data):
def test__iscsi_extent__disk_choices(request):
with dataset("test zvol", {
"type": "VOLUME",
"volsize": 1024000,
"volsize": 1048576,
}) as ds:
# Make snapshots available for devices
call("zfs.dataset.update", ds, {"properties": {"snapdev": {"parsed": "visible"}}})
Expand Down Expand Up @@ -55,7 +55,7 @@ def test__iscsi_extent__disk_choices(request):
def test__iscsi_extent__create_with_invalid_disk_with_whitespace(request):
with dataset("test zvol", {
"type": "VOLUME",
"volsize": 1024000,
"volsize": 1048576,
}) as ds:
with pytest.raises(ValidationErrors) as e:
with iscsi_extent({
Expand All @@ -73,7 +73,7 @@ def test__iscsi_extent__create_with_invalid_disk_with_whitespace(request):
def test__iscsi_extent__locked(request):
with dataset("test zvol", {
"type": "VOLUME",
"volsize": 1024000,
"volsize": 1048576,
"inherit_encryption": False,
"encryption": True,
"encryption_options": {"passphrase": "testtest"},
Expand Down
2 changes: 1 addition & 1 deletion tests/api2/test_pool_dataset_unlock_restart_vms.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def encryption_props():
@pytest.mark.parametrize("zvol", [True, False])
def test_restart_vm_on_dataset_unlock(zvol):
if zvol:
data = {"type": "VOLUME", "volsize": 1024000}
data = {"type": "VOLUME", "volsize": 1048576}
else:
data = {}

Expand Down