Skip to content

Commit

Permalink
Address review: use extend_context
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeagherix committed Oct 28, 2024
1 parent 41c3ada commit 00fc63e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/middlewared/middlewared/plugins/fcport.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Config:
namespace = "fcport"
datastore = "services.fibrechanneltotarget"
datastore_prefix = 'fc_'
datastore_extend_context = "fcport.extend_context"
datastore_extend = 'fcport.extend'
cli_namespace = "sharing.fc_port"
entry = FCPortEntry
Expand Down Expand Up @@ -310,7 +311,13 @@ async def compress(self, data):
return data

@private
async def extend(self, data):
async def extend_context(self, rows, extra):
return {
"fc.fc_host.query": await self.middleware.call('fc.fc_host.query')
}

@private
async def extend(self, data, context):
data['wwpn'] = None
data['wwpn_b'] = None
# We want to retrieve the WWPN associated with the port name
Expand All @@ -321,7 +328,7 @@ async def extend(self, data):
fc_host_alias = data['port']
chan = None
try:
fc_host_pair = await self.middleware.call('fc.fc_host.query', [['alias', '=', fc_host_alias]], {'get': True})
fc_host_pair = filter_list(context['fc.fc_host.query'], [('alias', '=', fc_host_alias)], {'get': True})
except MatchNotFound:
pass
else:
Expand Down

0 comments on commit 00fc63e

Please sign in to comment.