Fix defaults to storage and drive resources
If storage and/or drive resource emulation is not set up via sushy emulator configuration, some sane defaults must be used. Otherwise the clients trying to read either of these resources hit hard HTTP 500 response. Change-Id: I1118e4a98278a517ae2a9c80873886a6bb6520f1
This commit is contained in:
parent
538d98dd1e
commit
9d8709930f
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes defaults to storage and drive resources. Prior to this fix,
|
||||
if storage and/or drive resource emulation is not set up via sushy
|
||||
emulator configuration, the clients trying to read either of
|
||||
these resources would hit hard HTTP 500 response.
|
@ -28,7 +28,7 @@ class StaticDriver(DriverBase):
|
||||
@classmethod
|
||||
def initialize(cls, config):
|
||||
cls._config = config
|
||||
cls._drives = cls._config.get('SUSHY_EMULATOR_DRIVES')
|
||||
cls._drives = cls._config.get('SUSHY_EMULATOR_DRIVES', {})
|
||||
return cls
|
||||
|
||||
@property
|
||||
@ -60,5 +60,5 @@ class StaticDriver(DriverBase):
|
||||
|
||||
:returns: list of tuples representing the drives
|
||||
"""
|
||||
return [k + (d['Id'],) for k in self._drives.keys()
|
||||
return [k + (d['Id'],) for k in self._drives
|
||||
for d in self._drives[k]]
|
||||
|
@ -28,7 +28,7 @@ class StaticDriver(DriverBase):
|
||||
@classmethod
|
||||
def initialize(cls, config):
|
||||
cls._config = config
|
||||
cls._storage = cls._config.get('SUSHY_EMULATOR_STORAGE')
|
||||
cls._storage = cls._config.get('SUSHY_EMULATOR_STORAGE', {})
|
||||
return cls
|
||||
|
||||
@property
|
||||
@ -60,5 +60,5 @@ class StaticDriver(DriverBase):
|
||||
|
||||
:returns: list of tuples representing the storage instances
|
||||
"""
|
||||
return [(k, st["Id"]) for k in self._storage.keys()
|
||||
return [(k, st["Id"]) for k in self._storage
|
||||
for st in self._storage[k]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user