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-130324 / 24.10 / Treat ix-apps dataset specially in pool.dataset namespace #14103

Merged
merged 1 commit into from
Jul 30, 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
8 changes: 5 additions & 3 deletions src/middlewared/middlewared/alert/source/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ async def check(self):
unencrypted_datasets = []
for dataset in await self.middleware.call('pool.dataset.query', [['encrypted', '=', True]]):
for child in dataset['children']:
if child['name'] == f'{child["pool"]}/ix-applications' or child['name'].startswith(
f'{child["pool"]}/ix-applications/'
):
if child['name'] in (
f'{child["pool"]}/ix-applications', f'{child["pool"]}/ix-apps'
) or child['name'].startswith((
f'{child["pool"]}/ix-applications/', f'{child["pool"]}/ix-apps/'
)):
continue

if not child['encrypted']:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def cached(self, label):
'name': 'chia',
'categories': ['storage', 'crypto'],
'app_readme': 'app readme here',
'location': '/mnt/evo/ix-applications/catalogs/github_com_truenas_charts_git_master/charts/chia',
'location': '/mnt/evo/ix-apps/catalogs/github_com_truenas_charts_git_master/charts/chia',
'healthy': True,
'healthy_error': None,
'latest_version': '1.2.0',
Expand Down
8 changes: 6 additions & 2 deletions src/middlewared/middlewared/plugins/cloud_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ async def __aenter__(self):

if self.cloud_sync.get("path"):
if os.path.dirname(self.cloud_sync.get("path").rstrip("/")) == "/mnt":
rclone_filter.append("- /ix-applications")
rclone_filter.append("- /ix-applications/**")
rclone_filter.extend([
"- /ix-applications",
"- /ix-apps",
"- /ix-applications/**",
"- /ix-apps/**",
])

for item in self.cloud_sync.get("exclude") or []:
rclone_filter.append(f"- {item}")
Expand Down
6 changes: 3 additions & 3 deletions src/middlewared/middlewared/plugins/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ def listdir(self, path, filters, options):
if not path.is_dir():
raise CallError(f'Path {path} is not a directory', errno.ENOTDIR)

# TODO: once new apps implementation is in-place remove this check
if 'ix-applications' in path.parts:
raise CallError('Ix-applications is a system managed dataset and its contents cannot be listed')
for ds in ('ix-applications', 'ix-apps'):
if ds in path.parts:
raise CallError(f'{ds!r} is a system managed dataset and its contents cannot be listed')

file_type = None
for filter_ in filters:
Expand Down
1 change: 1 addition & 0 deletions src/middlewared/middlewared/plugins/pool_/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ async def internal_datasets_filters(self):
['pool', '!=', await self.middleware.call('boot.pool_name')],
['id', 'rnin', '/.system'],
['id', 'rnin', '/ix-applications/'],
['id', 'rnin', '/ix-apps/'],
]

@private
Expand Down
2 changes: 1 addition & 1 deletion src/middlewared/middlewared/plugins/pool_/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Config:
def cleanup_after_export(self, poolinfo, opts):
try:
if all((opts['destroy'], opts['cascade'])) and (contents := os.listdir(poolinfo['path'])):
if len(contents) == 1 and contents[0] == 'ix-applications':
if len(contents) == 1 and contents[0] in ('ix-applications', 'ix-apps'):
# This means:
# 1. zpool was destroyed (disks were wiped)
# 2. end-user chose to delete all share configuration associated
Expand Down
3 changes: 2 additions & 1 deletion src/middlewared/middlewared/plugins/pool_/import_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ async def import_pool(self, job, data):
# Recursively reset dataset mountpoints for the zpool.
recursive = True
for child in await self.middleware.call('zfs.dataset.child_dataset_names', pool_name):
if child == os.path.join(pool_name, 'ix-applications'):
if child in (os.path.join(pool_name, k) for k in ('ix-applications', 'ix-apps')):
# We exclude `ix-applications` dataset since resetting it will
# cause PVC's to not mount because "mountpoint=legacy" is expected.
# We exclude `ix-apps` dataset since it has a custom mountpoint in place
continue
try:
# Reset all mountpoints
Expand Down
4 changes: 2 additions & 2 deletions src/middlewared/middlewared/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def check_path_resides_within_volume_sync(verrors, schema_name, path, vol_names)
* path is within /mnt
* path is located within one of the specified `vol_names`
* path is not explicitly a `.zfs` or `.zfs/snapshot` directory
* path is not ix-applications dataset
* path is not ix-applications /ix-apps dataset
"""
if path_location(path).name == 'EXTERNAL':
# There are some fields where we allow external paths
Expand Down Expand Up @@ -428,7 +428,7 @@ def check_path_resides_within_volume_sync(verrors, schema_name, path, vol_names)
"be accessed through the path-based API, then it should be called "
"directly, e.g. '/mnt/dozer/.zfs/snapshot/mysnap'.")

for check_path, svc_name in (('ix-applications', 'Applications'),):
for check_path, svc_name in (('ix-applications', 'Applications'), ('ix-apps', 'Applications'),):
in_use = False
if is_mountpoint and rp.name == check_path:
in_use = True
Expand Down
Loading