Browse Source

Merge "Add RAIDType properties to storage resources"

tags/3.3.0^0
Zuul 4 weeks ago
committed by Gerrit Code Review
parent
commit
0dfe74afdf
9 changed files with 117 additions and 0 deletions
  1. +5
    -0
      releasenotes/notes/add-raid-type-properties-2090da5bea37c660.yaml
  2. +76
    -0
      sushy/resources/system/storage/constants.py
  3. +19
    -0
      sushy/resources/system/storage/mappings.py
  4. +5
    -0
      sushy/resources/system/storage/storage.py
  5. +3
    -0
      sushy/resources/system/storage/volume.py
  6. +4
    -0
      sushy/tests/unit/json_samples/storage.json
  7. +1
    -0
      sushy/tests/unit/json_samples/volume4.json
  8. +2
    -0
      sushy/tests/unit/resources/system/storage/test_storage.py
  9. +2
    -0
      sushy/tests/unit/resources/system/storage/test_volume.py

+ 5
- 0
releasenotes/notes/add-raid-type-properties-2090da5bea37c660.yaml View File

@@ -0,0 +1,5 @@
---
features:
- |
Add RAIDType property to the Volume resource and SupportedRAIDTypes
property to the Storage resource.

+ 76
- 0
sushy/resources/system/storage/constants.py View File

@@ -39,3 +39,79 @@ VOLUME_TYPE_SPANNED_MIRRORS = 'spannedmirrors'
VOLUME_TYPE_SPANNED_STRIPES_WITH_PARITY = 'spannedstripeswithparity'
"""The volume is a spanned set of devices which uses parity to retain
redundant information."""

# RAIDType Types
RAID_TYPE_RAID0 = 'RAID0'
"""A placement policy where consecutive logical blocks of data are uniformly
distributed across a set of independent storage devices without offering any
form of redundancy."""

RAID_TYPE_RAID1 = 'RAID1'
"""A placement policy where each logical block of data is stored on more than
one independent storage device."""

RAID_TYPE_RAID3 = 'RAID3'
"""A placement policy using parity-based protection where logical bytes of
data are uniformly distributed across a set of independent storage devices and
where the parity is stored on a dedicated independent storage device."""

RAID_TYPE_RAID4 = 'RAID4'
"""A placement policy using parity-based protection where logical blocks of
data are uniformly distributed across a set of independent storage devices and
where the parity is stored on a dedicated independent storage device."""

RAID_TYPE_RAID5 = 'RAID5'
"""A placement policy using parity-based protection for storing stripes of 'n'
logical blocks of data and one logical block of parity across a set of 'n+1'
independent storage devices where the parity and data blocks are interleaved
across the storage devices."""

RAID_TYPE_RAID6 = 'RAID6'
"""A placement policy using parity-based protection for storing stripes of 'n'
logical blocks of data and two logical blocks of independent parity across a
set of 'n+2' independent storage devices where the parity and data blocks are
interleaved across the storage devices."""

RAID_TYPE_RAID10 = 'RAID10'
"""A placement policy that creates a striped device (RAID 0) over a set of
mirrored devices (RAID 1)."""

RAID_TYPE_RAID01 = 'RAID01'
"""A data placement policy that creates a mirrored device (RAID 1) over a set
of striped devices (RAID 0)."""

RAID_TYPE_RAID6TP = 'RAID6TP'
"""A placement policy that uses parity-based protection for storing stripes of
'n' logical blocks of data and three logical blocks of independent parity
across a set of 'n+3' independent storage devices where the parity and data
blocks are interleaved across the storage devices."""

RAID_TYPE_RAID1E = 'RAID1E'
"""A placement policy that uses a form of mirroring implemented over a set of
independent storage devices where logical blocks are duplicated on a pair of
independent storage devices so that data is uniformly distributed across the
storage devices."""

RAID_TYPE_RAID50 = 'RAID50'
"""A placement policy that uses a RAID 0 stripe set over two or more RAID 5
sets of independent storage devices."""

RAID_TYPE_RAID60 = 'RAID60'
"""A placement policy that uses a RAID 0 stripe set over two or more RAID 6
sets of independent storage devices."""

RAID_TYPE_RAID00 = 'RAID00'
"""A placement policy that creates a RAID 0 stripe set over two or more RAID 0
sets."""

RAID_TYPE_RAID10E = 'RAID10E'
"""A placement policy that uses a RAID 0 stripe set over two or more RAID 10
sets."""

RAID_TYPE_RAID1Triple = 'RAID1Triple'
"""A placement policy where each logical block of data is mirrored three times
across a set of three independent storage devices."""

RAID_TYPE_RAID10Triple = 'RAID10Triple'
"""A placement policy that uses a striped device (RAID 0) over a set of triple
mirrored devices (RAID 1Triple)."""

+ 19
- 0
sushy/resources/system/storage/mappings.py View File

@@ -31,3 +31,22 @@ VOLUME_TYPE_TYPE_MAP = {
'SpannedStripesWithParity':
store_cons.VOLUME_TYPE_SPANNED_STRIPES_WITH_PARITY
}

RAID_TYPE_TYPE_MAP = {
'RAID0': store_cons.RAID_TYPE_RAID0,
'RAID1': store_cons.RAID_TYPE_RAID1,
'RAID3': store_cons.RAID_TYPE_RAID3,
'RAID4': store_cons.RAID_TYPE_RAID4,
'RAID5': store_cons.RAID_TYPE_RAID5,
'RAID6': store_cons.RAID_TYPE_RAID6,
'RAID10': store_cons.RAID_TYPE_RAID10,
'RAID01': store_cons.RAID_TYPE_RAID01,
'RAID6TP': store_cons.RAID_TYPE_RAID6TP,
'RAID1E': store_cons.RAID_TYPE_RAID1E,
'RAID50': store_cons.RAID_TYPE_RAID50,
'RAID60': store_cons.RAID_TYPE_RAID60,
'RAID00': store_cons.RAID_TYPE_RAID00,
'RAID10E': store_cons.RAID_TYPE_RAID10E,
'RAID1Triple': store_cons.RAID_TYPE_RAID1Triple,
'RAID10Triple': store_cons.RAID_TYPE_RAID10Triple,
}

+ 5
- 0
sushy/resources/system/storage/storage.py View File

@@ -19,6 +19,7 @@ from sushy.resources import base
from sushy.resources import common
from sushy.resources import mappings as res_maps
from sushy.resources.system.storage import drive
from sushy.resources.system.storage import mappings
from sushy.resources.system.storage import volume
from sushy import utils

@@ -52,6 +53,10 @@ class StorageControllersListField(base.ListField):
res_maps.PROTOCOL_TYPE_VALUE_MAP)
"""The protocols which the controller can use tocommunicate with devices"""

raid_types = base.MappedListField('SupportedRAIDTypes',
mappings.RAID_TYPE_TYPE_MAP)
"""The set of RAID types supported by the storage controller."""


class Storage(base.ResourceBase):
"""This class represents the storage subsystem resources.


+ 3
- 0
sushy/resources/system/storage/volume.py View File

@@ -44,6 +44,9 @@ class Volume(base.ResourceBase):
store_maps.VOLUME_TYPE_TYPE_MAP)
"""The type of this volume."""

raid_type = base.MappedField('RAIDType', store_maps.RAID_TYPE_TYPE_MAP)
"""The RAID type of this volume."""

encrypted = base.Field('Encrypted', adapter=bool)
"""Is this Volume encrypted."""



+ 4
- 0
sushy/tests/unit/json_samples/storage.json View File

@@ -39,6 +39,10 @@
"SupportedDeviceProtocols": [
"SAS",
"SATA"
],
"SupportedRAIDTypes": [
"RAID0",
"RAID1"
]
}
],


+ 1
- 0
sushy/tests/unit/json_samples/volume4.json View File

@@ -9,6 +9,7 @@
},
"Encrypted": false,
"VolumeType": "Mirrored",
"RAIDType": "RAID1",
"CapacityBytes": 107374182400,
"Identifiers": [
{


+ 2
- 0
sushy/tests/unit/resources/system/storage/test_storage.py View File

@@ -128,6 +128,8 @@ class StorageTestCase(base.TestCase):
controller.controller_protocols)
self.assertEqual([sushy.PROTOCOL_TYPE_SAS, sushy.PROTOCOL_TYPE_SATA],
controller.device_protocols)
self.assertEqual([sushy.RAID_TYPE_RAID0, sushy.RAID_TYPE_RAID1],
controller.raid_types)

def test_drives_after_refresh(self):
self.storage.refresh()


+ 2
- 0
sushy/tests/unit/resources/system/storage/test_volume.py View File

@@ -179,6 +179,7 @@ class VolumeCollectionTestCase(base.TestCase):
payload = {
'Name': 'My Volume 4',
'VolumeType': 'Mirrored',
'RAIDType': 'RAID1',
'CapacityBytes': 107374182400
}
with open('sushy/tests/unit/json_samples/volume4.json') as f:
@@ -197,3 +198,4 @@ class VolumeCollectionTestCase(base.TestCase):
self.assertEqual('My Volume 4', new_vol.name)
self.assertEqual(107374182400, new_vol.capacity_bytes)
self.assertEqual(sushy.VOLUME_TYPE_MIRRORED, new_vol.volume_type)
self.assertEqual(sushy.RAID_TYPE_RAID1, new_vol.raid_type)

Loading…
Cancel
Save