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-129042 / 24.04.2 / Do not crash zfs.dataset.unlocked_zvols_fast when volmode=full is… (by themylogin) #13745

Merged
merged 1 commit into from
May 16, 2024
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
5 changes: 5 additions & 0 deletions src/middlewared/middlewared/plugins/zfs_/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import enum
import logging
import os
import re

from middlewared.service_exception import MatchNotFound

Expand All @@ -11,6 +12,7 @@

LEGACY_USERPROP_PREFIX = 'org.freenas'
USERPROP_PREFIX = 'org.truenas'
ZD_PARTITION = re.compile(r'zd[0-9]+p[0-9]+$')


class TNUserProp(enum.Enum):
Expand Down Expand Up @@ -133,6 +135,9 @@ def get_zvols(info_level, data):
# skip this file
continue

if ZD_PARTITION.match(dev_name):
continue

out.update({
zvol_name: {
'path': path,
Expand Down
12 changes: 12 additions & 0 deletions tests/api2/test_zfs_dataset_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from middlewared.test.integration.assets.pool import dataset
from middlewared.test.integration.utils import call, ssh


def test__unlocked_zvols_fast__volmode():
with dataset("container") as container:
ssh(f"zfs set volmode=full {container}")

with dataset("container/zvol", {"type": "VOLUME", "volsize": 100 * 1024 * 1024}) as zvol:
ssh(f"sgdisk -n 1:1MiB:2MiB /dev/zvol/{zvol}")

call("zfs.dataset.unlocked_zvols_fast", [["name", "=", zvol]], {}, ["SIZE", "RO", "DEVID", "ATTACHMENT"])
Loading