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

vsp change device_model method #933

Merged
merged 4 commits into from
Oct 28, 2022
Merged
Changes from 3 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
15 changes: 8 additions & 7 deletions delfin/drivers/hitachi/vsp/rest_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ def get_token(self):

def login(self):
try:
succeed = False
succeed = self.get_device_id()
return succeed
self.get_device_id()
except Exception as e:
LOG.error("Login error: %s", six.text_type(e))
raise e
Expand Down Expand Up @@ -170,13 +168,14 @@ def logout(self):

def get_device_id(self):
try:
succeed = False
if self.session is None:
self.init_http_head()
storage_systems = self.get_system_info()
system_info = storage_systems.get('data')
for system in system_info:
succeed = True
self.storage_device_id = system.get('storageDeviceId')
self.device_model = system.get('model')
self.serial_number = system.get('serialNumber')
if system.get('svpIp'):
if system.get('svpIp') == self.rest_host:
self.storage_device_id = system.get('storageDeviceId')
Expand All @@ -190,8 +189,10 @@ def get_device_id(self):
self.serial_number = system.get('serialNumber')
break
if self.storage_device_id is None:
LOG.error("Get device id fail,model or something is wrong")
return succeed
error_msg = f'Get device id fail,' \
f'system info:{storage_systems}'
LOG.error(error_msg)
raise exception.StorageBackendException(error_msg)
except Exception as e:
LOG.error("Get device id error: %s", six.text_type(e))
raise e
Expand Down