Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-v committed May 23, 2020
1 parent f005542 commit a6702ef
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dolphin/drivers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def list_pools(self, context, storage_id):

def list_volumes(self, context, storage_id):
"""List all storage volumes from storage system."""
driver = self.driver_manager.get_driver(context, storage_id)
driver = self.driver_manager.get_driver(context, storage_id=storage_id)
return driver.list_volumes(context)

def add_trap_config(self, context, storage_id, trap_config):
Expand Down
33 changes: 20 additions & 13 deletions dolphin/drivers/dell_emc/vmax/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,18 @@ def list_pools(self):
def list_volumes(self, storage_id):

try:
# List all volumes
volumes = self.conn.provisioning.get_volume_list(filters={'data_volume': 'false'})
# List all volumes except data volumes
volumes = self.conn.provisioning.get_volume_list(
filters={'data_volume': 'false'})

# TODO: Update constants.VolumeStatus to make mapping more precise
switcher = {
'Ready': constants.VolumeStatus.AVAILABLE,
'Not Ready': constants.VolumeStatus.ERROR,
'Mixed': constants.VolumeStatus.ERROR,
'Write Disabled': constants.VolumeStatus.ERROR,
'N/A': constants.VolumeStatus.ERROR,
}

volume_list = []
for volume in volumes:
Expand All @@ -141,20 +151,17 @@ def list_volumes(self, storage_id):
used_cap = (total_cap * vol['allocated_percent']) / 100.0
free_cap = total_cap - used_cap

# TODO: Update constants.VolumeStatus to make mapping more precise
switcher = {
'Ready': constants.VolumeStatus.AVAILABLE,
'Not Ready': constants.VolumeStatus.ERROR,
'Mixed': constants.VolumeStatus.ERROR,
'Write Disabled': constants.VolumeStatus.ERROR,
'N/A': constants.VolumeStatus.ERROR,
}
status = switcher.get(vol['status'], constants.VolumeStatus.ERROR)
status = switcher.get(vol['status'],
constants.VolumeStatus.ERROR)

description = "Dell EMC VMAX volume"
if vol['type'] == 'TDEV':
description = "Dell EMC VMAX 'thin device' volume"

v = {
"name": volume,
"storage_id": storage_id,
"description": vol['type'],
"description": description,
"status": status,
"original_id": vol['volumeId'],
"wwn": vol['wwn'],
Expand All @@ -177,6 +184,6 @@ def list_volumes(self, storage_id):
return volume_list

except Exception as err:
LOG.error("Failed to get list volumes from vmax: {}".format(err))
LOG.error("Failed to get list volumes from VMAX: {}".format(err))
raise exception.StorageBackendException(
reason='Failed to get list volumes from VMAX')

0 comments on commit a6702ef

Please sign in to comment.