Skip to content

Commit

Permalink
vsp change device_model mothod (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjiangyu-ghca authored Oct 28, 2022
1 parent 996ff13 commit ddcdd27
Showing 1 changed file with 8 additions and 7 deletions.
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

0 comments on commit ddcdd27

Please sign in to comment.