From e52ed257da1107b64754f1f2b2033ed68661f86b Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Wed, 24 Jul 2024 14:08:26 +0500 Subject: [PATCH] Add util to retrieve app's volume ds --- src/middlewared/middlewared/plugins/apps/ix_apps/path.py | 4 ++++ .../middlewared/plugins/apps/schema_action_context.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/middlewared/middlewared/plugins/apps/ix_apps/path.py b/src/middlewared/middlewared/plugins/apps/ix_apps/path.py index 30adedc4a9e8..effd7003271d 100644 --- a/src/middlewared/middlewared/plugins/apps/ix_apps/path.py +++ b/src/middlewared/middlewared/plugins/apps/ix_apps/path.py @@ -15,6 +15,10 @@ def get_app_parent_config_path() -> str: return os.path.join(IX_APPS_MOUNT_PATH, 'app_configs') +def get_app_parent_volume_ds_name(docker_ds: str, app_name: str) -> str: + return os.path.join(docker_ds, 'app_mounts', app_name) + + def get_app_parent_volume_path() -> str: return os.path.join(IX_APPS_MOUNT_PATH, 'app_mounts') diff --git a/src/middlewared/middlewared/plugins/apps/schema_action_context.py b/src/middlewared/middlewared/plugins/apps/schema_action_context.py index a79e13a6c4d3..1ec90117aea0 100644 --- a/src/middlewared/middlewared/plugins/apps/schema_action_context.py +++ b/src/middlewared/middlewared/plugins/apps/schema_action_context.py @@ -2,6 +2,7 @@ from middlewared.service import CallError, Service +from .ix_apps.path import get_app_parent_volume_ds_name from .utils import DATASET_DEFAULTS @@ -12,7 +13,9 @@ class Config: private = True async def update_volumes(self, app_name, volumes): - app_volume_ds = os.path.join((await self.middleware.call('docker.config'))['dataset'], 'app_mounts', app_name) + app_volume_ds = get_app_parent_volume_ds_name( + (await self.middleware.call('docker.config'))['dataset'], app_name + ) user_wants = {app_volume_ds: {'properties': {}}} | {os.path.join(app_volume_ds, v['name']): v for v in volumes} existing_datasets = {