Skip to content

Commit

Permalink
Fix temporary mount of system dataset during move
Browse files Browse the repository at this point in the history
When moving the system dataset to a new pool we first temporarily
mount the system dataset in the middleware run directory before
running rsync to copy all of the data to the new path. During
a recent refactor of the system dataset heirarchy the nuance of
the temporary mount point was lost.
  • Loading branch information
anodos325 committed Mar 6, 2024
1 parent 9679069 commit 0813dc2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/middlewared/middlewared/plugins/sysdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,8 @@ def __mount(self, pool, uuid, path=SYSDATASET_PATH):
mounted = False
for ds_config in get_system_dataset_spec(pool, uuid):
dataset, name = ds_config['name'], os.path.basename(ds_config['name'])
if desired_mountpoint := ds_config.get('mountpoint'):
mountpoint = desired_mountpoint
else:
mountpoint = f'{path}/{name}'

mountpoint = ds_config.get('mountpoint', f'{SYSDATASET_PATH}/{name}').replace(SYSDATASET_PATH, path)

if os.path.ismount(mountpoint):
continue
Expand Down
10 changes: 10 additions & 0 deletions tests/api2/test_006_pool_and_sysds.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ def test_002_create_permanent_zpool(request, ws_client):
assert results['pool'] == pool_name
assert results['basename'] == f'{pool_name}/.system'

try:
sysdataset_update = ws_client.call('core.get_jobs', [
['method', '=', 'systemdataset.update']
], {'order_by': ['-id'], 'get': True})
except Exception:
fail('Failed to get status of systemdataset update')

if sysdataset_update['state'] != 'SUCCESS':
fail(f'System dataset move failed: {sysdataset_update["error"]}')


@pytest.mark.dependency(name='POOL_FUNCTIONALITY1')
def test_003_verify_unused_disk_and_sysds_functionality_on_2nd_pool(ws_client, pool_data):
Expand Down

0 comments on commit 0813dc2

Please sign in to comment.