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

update msa mapping view #833

Merged
merged 38 commits into from
May 20, 2022
Merged

update msa mapping view #833

merged 38 commits into from
May 20, 2022

Conversation

luojiagen
Copy link
Contributor

What this PR does / why we need it:

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Release note:

@codecov
Copy link

codecov bot commented Feb 23, 2022

Codecov Report

Merging #833 (0a168dc) into master (32769d1) will decrease coverage by 0.01%.
The diff coverage is 73.25%.

@@            Coverage Diff             @@
##           master     #833      +/-   ##
==========================================
- Coverage   71.35%   71.34%   -0.02%     
==========================================
  Files         182      182              
  Lines       20929    21127     +198     
  Branches     3194     3224      +30     
==========================================
+ Hits        14934    15073     +139     
- Misses       4984     5035      +51     
- Partials     1011     1019       +8     
Impacted Files Coverage Δ
delfin/drivers/hpe/hpe_msa/ssh_handler.py 67.29% <70.69%> (+1.67%) ⬆️
delfin/drivers/hpe/hpe_msa/hpe_msastor.py 85.10% <86.66%> (+0.73%) ⬆️
delfin/drivers/hpe/hpe_msa/consts.py 100.00% <100.00%> (ø)
delfin/drivers/fake_storage/__init__.py 93.63% <0.00%> (-0.77%) ⬇️

hosts_info = self.ssh_pool.do_exec('show host-groups')
host_list = []
hosts = self.handle_xml_to_json(hosts_info, 'host')
host_map = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

host_map is recommended to define to a set type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the defined type to set type
image

host_groups = self.handle_xml_to_json(
host_groups_info, 'host-group')
host_info_list = self.handle_xml_to_json(host_groups_info, 'host')
if host_groups:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if host_groups: is unnecessary, because handle_xml_to_json will return [] if there is no data in host_groups_info .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted this judgment
image

host_id = host_info.get('serial-number')
host_group_id = host_info.get('host-group')
if host_id != 'NOHOST':
if host_group_id == storage_host_group_id:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these two if should be written like if host_id != 'NOHOST' and host_group_id == storage_host_group_id .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two judgments are combined
image

}
return storage_host_groups_result
except Exception as e:
LOG.error("Failed to get host_groups from msa")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log info should contain storage info, such as storage_id , so we can know which storage is going wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error prompt statement changed
image

@@ -1,7 +1,7 @@
from delfin.common import constants
Copy link
Collaborator

@joseph-v joseph-v Apr 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a File banner as below for all files

# Copyright 2022 The SODA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Copy link
Collaborator

@wisererik wisererik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wisererik wisererik merged commit 00a5d58 into sodafoundation:master May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants