-
Notifications
You must be signed in to change notification settings - Fork 355
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
Conversation
update msa view mapping
Modify the method of parsing XML for msa
Hpe msa 2022
Codecov Report
@@ 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
|
hosts_info = self.ssh_pool.do_exec('show host-groups') | ||
host_list = [] | ||
hosts = self.handle_xml_to_json(hosts_info, 'host') | ||
host_map = {} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
return storage_host_groups_result | ||
except Exception as e: | ||
LOG.error("Failed to get host_groups from msa") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify the code according to the modification suggestions for msa
add get_access_url for msa
update host group for msa
@@ -1,7 +1,7 @@ | |||
from delfin.common import constants |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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: