From 608c188ecf294c42a5c89813518d9beea99b5436 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 11 Oct 2024 01:33:13 +0500 Subject: [PATCH 1/2] Make sure we mount docker datasets if only address pools are changed --- src/middlewared/middlewared/plugins/docker/update.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/middlewared/middlewared/plugins/docker/update.py b/src/middlewared/middlewared/plugins/docker/update.py index 1058ba864947d..4856e46ee8829 100644 --- a/src/middlewared/middlewared/plugins/docker/update.py +++ b/src/middlewared/middlewared/plugins/docker/update.py @@ -116,6 +116,10 @@ async def do_update(self, job, data): await self.middleware.call('docker.setup.status_change') elif config['pool'] and config['address_pools'] != old_config['address_pools']: job.set_progress(60, 'Starting docker') + catalog_sync_job = await self.middleware.call('docker.fs_manage.mount') + if catalog_sync_job: + await catalog_sync_job.wait() + await self.middleware.call('service.start', 'docker') if not old_config['nvidia'] and config['nvidia']: From bce44bd56910de48d10cabef28a147c9ee13a449 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 11 Oct 2024 01:45:34 +0500 Subject: [PATCH 2/2] Add an integration test to make sure docker datasets are mounted if address pool changes --- tests/api2/test_docker_setup.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/api2/test_docker_setup.py b/tests/api2/test_docker_setup.py index ab57dc6ba894c..1884d52da8996 100644 --- a/tests/api2/test_docker_setup.py +++ b/tests/api2/test_docker_setup.py @@ -58,6 +58,16 @@ def test_apps_are_running(): assert call('docker.status')['status'] == 'RUNNING' +@pytest.mark.dependency(depends=['docker_setup']) +def test_apps_dataset_after_address_pool_update(): + docker_config = call('docker.update', {'address_pools': [{'base': '172.17.0.0/12', 'size': 27}]}, job=True) + assert docker_config['address_pools'] == [{'base': '172.17.0.0/12', 'size': 27}] + assert call('filesystem.statfs', IX_APPS_MOUNT_PATH)['source'] == docker_config['dataset'] + assert call('docker.status')['status'] == 'RUNNING' + + def test_unset_docker_pool(docker_pool): - docker_config = call('docker.update', {'pool': None}, job=True) + docker_config = call( + 'docker.update', {'pool': None, 'address_pools': [{'base': '172.17.0.0/12', 'size': 24}]}, job=True + ) assert docker_config['pool'] is None, docker_config