Skip to content

Commit

Permalink
NAS-130796 / 25.04 / Do not allow iSCSI extents to use zvols on boot-…
Browse files Browse the repository at this point in the history
…pool (#14337)

* Do not allow iSCSI extents to use zvols on boot-pool
  • Loading branch information
bmeagherix authored Aug 23, 2024
1 parent f669a47 commit b682e87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/middlewared/middlewared/plugins/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ async def check_update_ashift_property(self):
if properties:
await self.middleware.call('zfs.pool.update', BOOT_POOL_NAME, {'properties': properties})

@private
async def is_boot_pool_path(self, path):
return path.startswith(f'/dev/zvol/{await self.pool_name()}/')


async def on_config_upload(middleware, path):
await middleware.call('boot.update_initramfs', {'database': path})
Expand Down
3 changes: 3 additions & 0 deletions src/middlewared/middlewared/plugins/iscsi_/extents.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ def clean_type_and_path(self, data, schema_name, verrors):
if not os.path.exists(device):
verrors.add(f'{schema_name}.disk', f'Device {device!r} for volume {zvol_name!r} does not exist')

if self.middleware.call_sync('boot.is_boot_pool_path', device):
verrors.add(f'{schema_name}.disk', 'Disk residing in boot pool cannot be consumed and is not supported')

if '@' in zvol_name and not data['ro']:
verrors.add(f'{schema_name}.ro', 'Must be set when disk is a ZFS Snapshot')

Expand Down

0 comments on commit b682e87

Please sign in to comment.