Skip to content

Commit

Permalink
edit list_masking_views
Browse files Browse the repository at this point in the history
  • Loading branch information
zhilong-xu committed Jan 28, 2022
1 parent 2c408d1 commit 28483e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions delfin/drivers/pure/flasharray/pure_flasharray.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,24 +470,23 @@ def list_volume_groups(self, context):

def list_masking_views(self, context):
list_masking_views = []
volume_g = self.get_volume_group()
masking_views = self.rest_handler.rest_call(
self.rest_handler.REST_HOST_ALL_URL)
view_id_dict = {}
for masking_view in (masking_views or []):
hgroup = masking_view.get('hgroup')
host_id = masking_view.get('name')
native_volume_id = masking_view.get('vol')
native_masking_view_id = '{}{}'.format(host_id, native_volume_id)
native_masking_view_id = '{}{}{}'.format(
host_id, hgroup, native_volume_id)
if view_id_dict.get(native_masking_view_id):
continue
view_id_dict[native_masking_view_id] = native_masking_view_id
view = {
'native_masking_view_id': native_masking_view_id,
'name': native_masking_view_id,
'native_storage_host_group_id': masking_view.get('hgroup') if
masking_view.get('hgroup') else None,
'native_volume_group_id': volume_g.get(native_volume_id),
'native_storage_host_id': host_id,
'native_storage_host_group_id': hgroup if hgroup else None,
'native_storage_host_id': None if hgroup else host_id,
'native_volume_id': native_volume_id,
'storage_id': self.storage_id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,7 @@ def test_list_volume_groups(self):

def test_list_masking_views(self):
RestHandler.rest_call = mock.Mock(
side_effect=[VOLUME_GROUP_INFO, HOSTS_ALL_INFO])
side_effect=[HOSTS_ALL_INFO])
views = self.driver.list_masking_views(context)
self.assertEqual(views[0].get('native_volume_id'),
HOSTS_ALL_INFO[0].get('vol'))

0 comments on commit 28483e2

Please sign in to comment.