Skip to content

Commit

Permalink
NAS-109388 / 12.0 / Report boot pool for disks (#6632)
Browse files Browse the repository at this point in the history
(cherry picked from commit 80716f0)

Co-authored-by: themylogin <themylogin@gmail.com>
  • Loading branch information
bugclerk and themylogin committed Apr 21, 2021
1 parent ad403df commit b07cdc2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/middlewared/middlewared/plugins/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ async def disk_extend(self, disk, context):
else:
disk.pop('passwd')
disk.pop('kmip_uid')
disk['pool'] = context['zfs_guid_to_pool'].get(disk['zfs_guid'])
if disk['name'] in context['boot_pool_disks']:
disk['pool'] = context['boot_pool_name']
else:
disk['pool'] = context['zfs_guid_to_pool'].get(disk['zfs_guid'])
return disk

@private
Expand All @@ -121,13 +124,18 @@ async def disk_extend_context(self, extra):
'disks_keys': {},

'pools': extra.get('pools', False),
'boot_pool_disks': [],
'boot_pool_name': None,
'zfs_guid_to_pool': {},
}

if context['passwords']:
context['disks_keys'] = await self.middleware.call('kmip.retrieve_sed_disks_keys')

if context['pools']:
context['boot_pool_disks'] = await self.middleware.call('boot.get_disks')
context['boot_pool_name'] = await self.middleware.call('boot.pool_name')

for pool in await self.middleware.call('zfs.pool.query'):
topology = await self.middleware.call('pool.transform_topology_lightweight', pool['groups'])
for vdev in await self.middleware.call('pool.flatten_topology', topology):
Expand Down

0 comments on commit b07cdc2

Please sign in to comment.