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 vplex port default value setting method #141

Merged
merged 2 commits into from
Jun 4, 2021
Merged
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
26 changes: 17 additions & 9 deletions delfin/drivers/dell_emc/vplex/vplex_stor.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ def get_hardware_port_info(self, nest_map, first_key, second_key):
role = ''
port_status = ''
operational_status = ''

if nest_map:
second_map = nest_map.get(first_key)
if second_map:
Expand All @@ -501,8 +500,10 @@ def analyse_hardware_port(resp, hardware_port_map):
port_list = VplexStorageDriver.get_context_list(resp)
if port_list:
for port in port_list:
port_name = port.get("attributes").get("target-port")
hardware_port_map[port_name] = port
port_attr = port.get("attributes")
if port_attr:
port_name = port_attr.get("target-port")
hardware_port_map[port_name] = port

@staticmethod
def analyse_port_type(protocols):
Expand Down Expand Up @@ -531,13 +532,20 @@ def analyse_port_health_status(status):
get(status, constants.PortHealthStatus.UNKNOWN)

@staticmethod
def analyse_speed(speed):
speed_value = None
if speed:
match_obj = re.search(r'([1-9]\d*\.?\d*)|(0\.\d*[1-9])', speed)
def analyse_speed(speed_value):
speed = None
if speed_value:
match_obj = re.search(r'([1-9]\d*\.?\d*)|(0\.\d*[1-9])',
speed_value)
if match_obj:
speed_value = int(match_obj.group(0)) * units.G
return speed_value
speed = int(match_obj.group(0))
if 'Gbit' in speed_value:
speed = speed * units.G
elif 'Mbit' in speed_value:
speed = speed * units.M
elif 'Kbit' in speed_value:
speed = speed * units.k
return speed


@staticmethod
Expand Down