Merge "Deprecated field in Redfish Driver"
This commit is contained in:
commit
111466f782
@ -242,8 +242,7 @@ class DracRedfishRAID(redfish_raid.RedfishRAID):
|
|||||||
"""
|
"""
|
||||||
for storage in system.storage.get_members():
|
for storage in system.storage.get_members():
|
||||||
if storage.identity == identity:
|
if storage.identity == identity:
|
||||||
controller = (storage.storage_controllers[0]
|
controller = redfish_utils.get_first_controller(storage)
|
||||||
if storage.storage_controllers else None)
|
|
||||||
if controller:
|
if controller:
|
||||||
return storage, controller
|
return storage, controller
|
||||||
|
|
||||||
|
@ -125,8 +125,7 @@ def get_physical_disks(node):
|
|||||||
try:
|
try:
|
||||||
collection = system.storage
|
collection = system.storage
|
||||||
for storage in collection.get_members():
|
for storage in collection.get_members():
|
||||||
controller = (storage.storage_controllers[0]
|
controller = redfish_utils.get_first_controller(storage)
|
||||||
if storage.storage_controllers else None)
|
|
||||||
if controller and controller.raid_types == []:
|
if controller and controller.raid_types == []:
|
||||||
continue
|
continue
|
||||||
disks.extend(storage.drives)
|
disks.extend(storage.drives)
|
||||||
@ -590,8 +589,7 @@ def _get_storage_controller(node, system, physical_disks):
|
|||||||
collection = system.storage
|
collection = system.storage
|
||||||
for storage in collection.get_members():
|
for storage in collection.get_members():
|
||||||
# Using first controller as expecting only one
|
# Using first controller as expecting only one
|
||||||
controller = (storage.storage_controllers[0]
|
controller = redfish_utils.get_first_controller(storage)
|
||||||
if storage.storage_controllers else None)
|
|
||||||
if controller and controller.raid_types == []:
|
if controller and controller.raid_types == []:
|
||||||
continue
|
continue
|
||||||
for drive in storage.drives:
|
for drive in storage.drives:
|
||||||
@ -1130,8 +1128,7 @@ class RedfishRAID(base.RAIDInterface):
|
|||||||
any_left = False
|
any_left = False
|
||||||
try:
|
try:
|
||||||
for storage in system.storage.get_members():
|
for storage in system.storage.get_members():
|
||||||
controller = (storage.storage_controllers[0]
|
controller = redfish_utils.get_first_controller(storage)
|
||||||
if storage.storage_controllers else None)
|
|
||||||
controller_id = None
|
controller_id = None
|
||||||
if controller:
|
if controller:
|
||||||
controller_id = storage.identity
|
controller_id = storage.identity
|
||||||
|
@ -322,6 +322,19 @@ def get_event_service(node):
|
|||||||
raise exception.RedfishError(error=e)
|
raise exception.RedfishError(error=e)
|
||||||
|
|
||||||
|
|
||||||
|
def get_first_controller(storage):
|
||||||
|
"""Get the first storage controller from a storage object.
|
||||||
|
|
||||||
|
:param storage: a storage object
|
||||||
|
:returns: the first storage controller or None
|
||||||
|
"""
|
||||||
|
if hasattr(storage, 'controllers'):
|
||||||
|
return storage.controllers[0]
|
||||||
|
elif hasattr(storage, 'storage_controllers'):
|
||||||
|
return storage.storage_controllers[0]
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_system(node):
|
def get_system(node):
|
||||||
"""Get a Redfish System that represents a node.
|
"""Get a Redfish System that represents a node.
|
||||||
|
|
||||||
|
@ -238,11 +238,11 @@ class DracRedfishRAIDTestCase(test_utils.BaseDracTest):
|
|||||||
identity='Disk.Direct.0-0:AHCI.Slot.2-1')
|
identity='Disk.Direct.0-0:AHCI.Slot.2-1')
|
||||||
|
|
||||||
mock_controller1 = mock.Mock()
|
mock_controller1 = mock.Mock()
|
||||||
mock_storage1 = mock.Mock(storage_controllers=[mock_controller1],
|
mock_storage1 = mock.Mock(controllers=[mock_controller1],
|
||||||
drives=[mock_drive1, mock_drive2],
|
drives=[mock_drive1, mock_drive2],
|
||||||
identity='RAID.Integrated.1-1')
|
identity='RAID.Integrated.1-1')
|
||||||
mock_controller2 = mock.Mock()
|
mock_controller2 = mock.Mock()
|
||||||
mock_storage2 = mock.Mock(storage_controllers=[mock_controller2],
|
mock_storage2 = mock.Mock(controllers=[mock_controller2],
|
||||||
drives=[mock_drive3],
|
drives=[mock_drive3],
|
||||||
identity='AHCI.Slot.2-1')
|
identity='AHCI.Slot.2-1')
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class RedfishRAIDTestCase(db_base.DbTestCase):
|
|||||||
self.mock_storage.drives = mock_drives
|
self.mock_storage.drives = mock_drives
|
||||||
mock_controller = mock.Mock()
|
mock_controller = mock.Mock()
|
||||||
mock_controller.raid_types = ['RAID1', 'RAID5', 'RAID10']
|
mock_controller.raid_types = ['RAID1', 'RAID5', 'RAID10']
|
||||||
self.mock_storage.storage_controllers = [mock_controller]
|
self.mock_storage.controllers = [mock_controller]
|
||||||
mock_volumes = mock.MagicMock()
|
mock_volumes = mock.MagicMock()
|
||||||
self.mock_storage.volumes = mock_volumes
|
self.mock_storage.volumes = mock_volumes
|
||||||
self.free_space_bytes = {d: d.capacity_bytes for d in
|
self.free_space_bytes = {d: d.capacity_bytes for d in
|
||||||
@ -1137,7 +1137,7 @@ class RedfishRAIDTestCase(db_base.DbTestCase):
|
|||||||
nonraid_controller = mock.Mock()
|
nonraid_controller = mock.Mock()
|
||||||
nonraid_controller.raid_types = []
|
nonraid_controller.raid_types = []
|
||||||
nonraid_storage = mock.MagicMock()
|
nonraid_storage = mock.MagicMock()
|
||||||
nonraid_storage.storage_controllers = [nonraid_controller]
|
nonraid_storage.controllers = [nonraid_controller]
|
||||||
nonraid_storage.drives = [_mock_drive(
|
nonraid_storage.drives = [_mock_drive(
|
||||||
identity='Drive1', block_size_bytes=512,
|
identity='Drive1', block_size_bytes=512,
|
||||||
capacity_bytes=899527000000,
|
capacity_bytes=899527000000,
|
||||||
@ -1162,7 +1162,7 @@ class RedfishRAIDTestCase(db_base.DbTestCase):
|
|||||||
nonraid_controller = mock.Mock()
|
nonraid_controller = mock.Mock()
|
||||||
nonraid_controller.raid_types = []
|
nonraid_controller.raid_types = []
|
||||||
nonraid_storage = mock.MagicMock()
|
nonraid_storage = mock.MagicMock()
|
||||||
nonraid_storage.storage_controllers = [nonraid_controller]
|
nonraid_storage.controllers = [nonraid_controller]
|
||||||
nonraid_storage.drives = mock.Mock()
|
nonraid_storage.drives = mock.Mock()
|
||||||
|
|
||||||
mock_get_system.return_value.storage.get_members.return_value = [
|
mock_get_system.return_value.storage.get_members.return_value = [
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Replaces deprecated ``Storage.StorageControllers`` in Redfish RAID
|
||||||
|
with ``Storage.Controllers``, which provides an array of links to
|
||||||
|
controller objects instead of embedding the full controller objects.
|
||||||
|
The old field is now used as a fallback.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user