Add missing noop implementations to fake-hardware

Currently operators have to enable all fake interfaces even if
they don't plan on using them.

Change-Id: If6cf0194f199b395388ed837cb4d46d51a1dd893
Closes-Bug: #1749256
This commit is contained in:
Dmitry Tantsur 2018-02-13 19:07:32 +01:00
parent 180277a65a
commit ce5fd966a0
3 changed files with 22 additions and 14 deletions

View File

@ -18,6 +18,8 @@ Fake hardware type.
from ironic.drivers import hardware_type
from ironic.drivers.modules import fake
from ironic.drivers.modules import noop
from ironic.drivers.modules.storage import noop as noop_storage
class FakeHardware(hardware_type.AbstractHardwareType):
@ -39,7 +41,7 @@ class FakeHardware(hardware_type.AbstractHardwareType):
@property
def supported_console_interfaces(self):
"""List of classes of supported console interfaces."""
return [fake.FakeConsole]
return [fake.FakeConsole, noop.NoConsole]
@property
def supported_deploy_interfaces(self):
@ -49,7 +51,7 @@ class FakeHardware(hardware_type.AbstractHardwareType):
@property
def supported_inspect_interfaces(self):
"""List of classes of supported inspect interfaces."""
return [fake.FakeInspect]
return [fake.FakeInspect, noop.NoInspect]
@property
def supported_management_interfaces(self):
@ -64,22 +66,22 @@ class FakeHardware(hardware_type.AbstractHardwareType):
@property
def supported_raid_interfaces(self):
"""List of classes of supported raid interfaces."""
return [fake.FakeRAID]
return [fake.FakeRAID, noop.NoRAID]
@property
def supported_rescue_interfaces(self):
"""List of classes of supported rescue interfaces."""
return [fake.FakeRescue]
return [fake.FakeRescue, noop.NoRescue]
@property
def supported_storage_interfaces(self):
"""List of classes of supported storage interfaces."""
return [fake.FakeStorage]
return [fake.FakeStorage, noop_storage.NoopStorage]
@property
def supported_vendor_interfaces(self):
"""List of classes of supported rescue interfaces."""
return [fake.FakeVendorB, fake.FakeVendorA]
return [fake.FakeVendorB, fake.FakeVendorA, noop.NoVendor]
@property
def supported_network_interfaces(self):

View File

@ -618,8 +618,8 @@ class TestFakeHardware(hardware_type.AbstractHardwareType):
return [fake.FakeVendorB, fake.FakeVendorA]
OPTIONAL_INTERFACES = set(drivers_base.BareDriver().standard_interfaces) - {
'management', 'boot'}
OPTIONAL_INTERFACES = (set(drivers_base.BareDriver().standard_interfaces) -
{'management', 'boot'}) | {'vendor'}
class HardwareTypeLoadTestCase(db_base.DbTestCase):
@ -797,16 +797,16 @@ class HardwareTypeLoadTestCase(db_base.DbTestCase):
ht = fake_hardware.FakeHardware()
expected = {
'boot': set(['fake']),
'console': set(['fake']),
'console': set(['fake', 'no-console']),
'deploy': set(['fake']),
'inspect': set(['fake']),
'inspect': set(['fake', 'no-inspect']),
'management': set(['fake']),
'network': set(['noop']),
'power': set(['fake']),
'raid': set(['fake']),
'rescue': set(['fake']),
'storage': set([]),
'vendor': set(['fake'])
'raid': set(['fake', 'no-raid']),
'rescue': set(['fake', 'no-rescue']),
'storage': set(['noop']),
'vendor': set(['fake', 'no-vendor'])
}
if enable_storage:
self.config(enabled_storage_interfaces=['fake'])

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Adds missed noop implementations (e.g. ``no-inspect``) to the
``fake-hardware`` hardware type. This fixes enabling this hardware type
without enabling all (even optional) ``fake`` interfaces.