diff --git a/delfin/drivers/pure/flasharray/pure_flasharray.py b/delfin/drivers/pure/flasharray/pure_flasharray.py index bf4c0972a..7ba92490d 100644 --- a/delfin/drivers/pure/flasharray/pure_flasharray.py +++ b/delfin/drivers/pure/flasharray/pure_flasharray.py @@ -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 } diff --git a/delfin/tests/unit/drivers/pure/flasharray/test_pure_flasharray.py b/delfin/tests/unit/drivers/pure/flasharray/test_pure_flasharray.py index e545b0995..b9014292c 100644 --- a/delfin/tests/unit/drivers/pure/flasharray/test_pure_flasharray.py +++ b/delfin/tests/unit/drivers/pure/flasharray/test_pure_flasharray.py @@ -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'))