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

Hpe 3par adds controller, disk, and port interfaces #579

Merged
merged 14 commits into from
Jun 3, 2021

Conversation

yuanyu-ghca
Copy link
Contributor

What this PR does / why we need it:
1 add controller interface
2 add disk interface
3 add port interface

Which issue this PR fixes (optional, in fixes #(, 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 May 28, 2021

Codecov Report

Merging #579 (0427869) into master (7172b48) will increase coverage by 0.44%.
The diff coverage is 81.11%.

@@            Coverage Diff             @@
##           master     #579      +/-   ##
==========================================
+ Coverage   71.59%   72.04%   +0.44%     
==========================================
  Files         141      141              
  Lines       11267    11618     +351     
  Branches     1283     1352      +69     
==========================================
+ Hits         8067     8370     +303     
- Misses       2787     2807      +20     
- Partials      413      441      +28     
Impacted Files Coverage Δ
delfin/drivers/hpe/hpe_3par/hpe_3parstor.py 80.32% <66.66%> (+2.14%) ⬆️
delfin/drivers/hpe/hpe_3par/component_handler.py 75.41% <73.33%> (-2.68%) ⬇️
delfin/drivers/hpe/hpe_3par/ssh_handler.py 77.73% <84.54%> (+47.08%) ⬆️
delfin/drivers/hpe/hpe_3par/consts.py 100.00% <100.00%> (ø)

raise exception.InvalidPrivateKey()
else:
raise exception.SSHException(err)
return result
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will create exception if 'result' is not defined (if condition on line 397 fails)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified,In addition, when NetApp is integrated, 3PAR's SSH methods are also modified to use public methods to query

LOG.error("Get %s info error: %s" % (command, six.text_type(e)))
if ckeck_excep:
raise e
return resources_info
Copy link
Collaborator

Choose a reason for hiding this comment

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

Variable resources_info needs to be initialized

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified

rate = ''
if ports_connected_map:
rate = ports_connected_map.get(port_id, '')
if not ip_addr and ports_iscsi_map:
Copy link
Collaborator

@sushanthakumar sushanthakumar May 31, 2021

Choose a reason for hiding this comment

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

"not ip_addr" can be placed outside as it is neede in multiple cases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each map extracts different values, and when a value is found in one of the maps, there is no need to extract values from other maps. If you add NOT IP_ADDR to the outermost layer, it will look up each map once.

'NORMAL': constants.DiskStatus.NORMAL,
'DEGRADED': constants.DiskStatus.ABNORMAL,
'FAILED': constants.DiskStatus.ABNORMAL,
'NEW': constants.DiskStatus.ABNORMAL
Copy link
Collaborator

@sushanthakumar sushanthakumar May 31, 2021

Choose a reason for hiding this comment

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

query: Should it not be NORMAL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Disk state does not have 'query' property, only contains' NORMAL, DEGRADED, FAILED, NEW '

Copy link
Collaborator

@sushanthakumar sushanthakumar May 31, 2021

Choose a reason for hiding this comment

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

I meant It was query or doubt :), sorry, not written clearly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

'NORMAL': constants.DiskStatus.NORMAL,Others are classified as abnormal

para_map=para_map)
except Exception as e:
LOG.error("Get %s info error: %s" % (command, six.text_type(e)))
if ckeck_excep:
Copy link
Collaborator

Choose a reason for hiding this comment

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

ckeck_excep = check_excep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified into 'throw_excep'

LOG.error("Get %s info error: %s" % (command, six.text_type(e)))
if ckeck_excep:
raise e
return resources_info
Copy link
Collaborator

Choose a reason for hiding this comment

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

Incase of ckeck_excep=false, in case of exception, empty lists will be returned like inventory_map
.Pls check if that is ok for all ckeck_excep=false cases. Normally we will just allow exception to pass on if it happens

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only the main method will throw an exception if there is an exception. The query method of other individual properties does not need to throw an exception. If throwing an exception will affect the overall return result, such as the IP address of the port, it needs another method to find out. If there is an exception in the query, the exception will be thrown, which does not affect the return of other properties

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got the scenarios, thanks

codecov.yml Outdated
default: # This can be anything, but it needs to exist as the name
# basic settings
target: auto
threshold: 5%
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we set coverage threshold drop to 0% ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current coverage rate is 71.25%, which is 70% according to the regulations. However, after modifying the code, the coverage rate of compilation check is reduced by 0.01%, so the coverage rate cannot pass. This problem can be avoided by configuring this parameter
Threshold: 5% means that when the coverage is greater than 70 and the change is less than 5%, it can be passed

port_list.append(port_model)
return port_list

def analyse_speed(self, speed_value):
Copy link
Member

Choose a reason for hiding this comment

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

Can we change name to parse_speed ? analyse is confusinf name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified

self.analyse_node_version,
throw_excep=False)

def analyse_node_version(self, resource_info, pattern_str, para_map=None):
Copy link
Member

Choose a reason for hiding this comment

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

can we name it parse_node_version ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified

fcoe_map[fcoe.get('n:s:p')] = fcoe
return fcoe_map

def analyse_datas_to_list(self, resource_info, pattern_str, para_map=None):
Copy link
Member

Choose a reason for hiding this comment

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

parse_datas ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified

raise exception.InvalidResults(err_msg)
return obj_list

def analyse_datas_to_map(self, resource_info, pattern_str, para_map=None):
Copy link
Member

Choose a reason for hiding this comment

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

parse_datas_to_map ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified

raise exception.InvalidResults(err_msg)
return obj_model

def analyse_disk_inventory(self, cols_size, titles_size, str_info,
Copy link
Member

Choose a reason for hiding this comment

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

parse_disk_table ??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified

obj_list.append(inventory_map)
return obj_list

def analyse_nodes(self, cols_size, titles_size, str_info, obj_list):
Copy link
Member

Choose a reason for hiding this comment

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

parse_node_table??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified

@sushanthakumar
Copy link
Collaborator

LGTM

NajmudheenCT
NajmudheenCT previously approved these changes Jun 1, 2021
Copy link
Member

@NajmudheenCT NajmudheenCT left a comment

Choose a reason for hiding this comment

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

LGTM

NajmudheenCT
NajmudheenCT previously approved these changes Jun 2, 2021
Copy link
Member

@NajmudheenCT NajmudheenCT left a comment

Choose a reason for hiding this comment

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

LGTM

joseph-v
joseph-v previously approved these changes Jun 3, 2021
Copy link
Collaborator

@joseph-v joseph-v left a comment

Choose a reason for hiding this comment

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

LGTM

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

Copy link
Member

@NajmudheenCT NajmudheenCT left a comment

Choose a reason for hiding this comment

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

LGTM

@NajmudheenCT NajmudheenCT merged commit 1a77e3f into sodafoundation:master Jun 3, 2021
@yuanyu-ghca yuanyu-ghca deleted the hpe_3par branch June 8, 2021 07:56
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.

8 participants