Skip to content

Commit

Permalink
Merge branch 'master' into vsp_host
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjiangyu-ghca authored Feb 11, 2022
2 parents cf43f09 + ce1080e commit 0d9d9f9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
30 changes: 22 additions & 8 deletions delfin/drivers/hitachi/vsp/vsp_stor.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ class HitachiVspDriver(driver.StorageDriver):
"VMWARE_EX": constants.HostOSTypes.VMWARE_ESX,
"WIN_EX": constants.HostOSTypes.WINDOWS
}

DISK_STATUS_TYPE = {"NML": constants.DiskStatus.NORMAL,
"CPY": constants.DiskStatus.NORMAL,
"CPI": constants.DiskStatus.NORMAL,
"RSV": constants.DiskStatus.NORMAL,
"FAI": constants.DiskStatus.ABNORMAL,
"BLK": constants.DiskStatus.ABNORMAL,
"WAR": constants.DiskStatus.ABNORMAL,
"UNK": constants.DiskStatus.NORMAL,
"Unknown": constants.DiskStatus.NORMAL
}
TIME_PATTERN = '%Y-%m-%dT%H:%M:%S'
AUTO_PORT_SPEED = 8 * units.Gi

Expand Down Expand Up @@ -371,13 +380,18 @@ def list_disks(self, context):
if disks is not None:
disk_entries = disks.get('data')
for disk in disk_entries:
status = constants.DiskStatus.ABNORMAL
if disk.get('status' == 'NML'):
status = constants.DiskStatus.NORMAL
physical_type = \
HitachiVspDriver.DISK_PHYSICAL_TYPE_MAP.get(
disk.get('driveTypeName'),
constants.DiskPhysicalType.UNKNOWN)
status = HitachiVspDriver.DISK_STATUS_TYPE.get(
disk.get('status'), constants.DiskStatus.NORMAL)
if disk.get('driveTypeName'):
type_name = 'SSD' if 'SSD' in \
disk.get('driveTypeName').upper()\
else disk.get('driveTypeName')
physical_type = \
HitachiVspDriver.DISK_PHYSICAL_TYPE_MAP.get(
type_name,
constants.DiskPhysicalType.UNKNOWN)
else:
physical_type = constants.DiskPhysicalType.UNKNOWN
logical_type = HitachiVspDriver.DISK_LOGIC_TYPE_MAP.get(
disk.get('usageType'),
constants.DiskLogicalType.UNKNOWN)
Expand Down
12 changes: 6 additions & 6 deletions delfin/tests/unit/drivers/hitachi/vsp/test_hitachi_vspstor.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(self):
"data": [
{
"driveLocationId": "0-0",
"driveTypeName": "SAS",
"driveTypeName": "SSD(FMC)",
"driveSpeed": 10000,
"totalCapacity": 600,
"driveType": "DKR5D-J600SS",
Expand Down Expand Up @@ -327,8 +327,8 @@ def __init__(self):
'serial_number': '123456789012345678901',
'speed': 10000,
'capacity': 644245094400,
'status': 'abnormal',
'physical_type': 'sas',
'status': 'normal',
'physical_type': 'ssd',
'logical_type': 'member',
'native_disk_group_id': '1-6',
'location': '0-0'
Expand All @@ -339,7 +339,7 @@ def __init__(self):
'serial_number': '123456789012345678902',
'speed': 10000,
'capacity': 644245094400,
'status': 'abnormal',
'status': 'normal',
'physical_type': 'sas',
'logical_type': 'member',
'native_disk_group_id': '1-6',
Expand All @@ -351,7 +351,7 @@ def __init__(self):
'serial_number': '123456789012345678903',
'speed': 10000,
'capacity': 644245094400,
'status': 'abnormal',
'status': 'normal',
'physical_type': 'sas',
'logical_type': 'member',
'native_disk_group_id': '1-6',
Expand All @@ -363,7 +363,7 @@ def __init__(self):
'serial_number': '123456789012345678904',
'speed': 10000,
'capacity': 644245094400,
'status': 'abnormal',
'status': 'normal',
'physical_type': 'sas',
'logical_type': 'member',
'native_disk_group_id': '1-6',
Expand Down

0 comments on commit 0d9d9f9

Please sign in to comment.