Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit list_masking_views #473

Merged
merged 1 commit into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'))