Derive FakeHardware from GenericHardware
Currently FakeHardware supports any interfaces because of a hack in the driver factory. However, when calculating the defaults we still rely on supported_***_interfaces in it, which makes enabling fake-hardware with non-fake interfaces harder than it should be. Change-Id: Ic90c94a85c32fab19ba1a40d7d826a8a65c027e7
This commit is contained in:
parent
19cafb55e1
commit
d4b99401af
@ -23,7 +23,6 @@ from ironic.common import exception
|
|||||||
from ironic.common.i18n import _
|
from ironic.common.i18n import _
|
||||||
from ironic.conf import CONF
|
from ironic.conf import CONF
|
||||||
from ironic.drivers import base as driver_base
|
from ironic.drivers import base as driver_base
|
||||||
from ironic.drivers import fake_hardware
|
|
||||||
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
@ -98,6 +97,7 @@ def get_interface(hw_type, interface_type, interface_name):
|
|||||||
entrypoint=factory._entrypoint_name,
|
entrypoint=factory._entrypoint_name,
|
||||||
valid=factory.names)
|
valid=factory.names)
|
||||||
|
|
||||||
|
from ironic.drivers import fake_hardware # avoid circular import
|
||||||
if isinstance(hw_type, fake_hardware.FakeHardware):
|
if isinstance(hw_type, fake_hardware.FakeHardware):
|
||||||
# NOTE(dtantsur): special-case fake hardware type to allow testing with
|
# NOTE(dtantsur): special-case fake hardware type to allow testing with
|
||||||
# any combinations of interface implementations.
|
# any combinations of interface implementations.
|
||||||
|
@ -16,13 +16,11 @@
|
|||||||
Fake hardware type.
|
Fake hardware type.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ironic.drivers import hardware_type
|
from ironic.drivers import generic
|
||||||
from ironic.drivers.modules import fake
|
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):
|
class FakeHardware(generic.GenericHardware):
|
||||||
"""Fake hardware type.
|
"""Fake hardware type.
|
||||||
|
|
||||||
This hardware type is special-cased in the driver factory to bypass
|
This hardware type is special-cased in the driver factory to bypass
|
||||||
@ -35,27 +33,27 @@ class FakeHardware(hardware_type.AbstractHardwareType):
|
|||||||
@property
|
@property
|
||||||
def supported_bios_interfaces(self):
|
def supported_bios_interfaces(self):
|
||||||
"""List of classes of supported bios interfaces."""
|
"""List of classes of supported bios interfaces."""
|
||||||
return [fake.FakeBIOS, noop.NoBIOS]
|
return [fake.FakeBIOS] + super().supported_bios_interfaces
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_boot_interfaces(self):
|
def supported_boot_interfaces(self):
|
||||||
"""List of classes of supported boot interfaces."""
|
"""List of classes of supported boot interfaces."""
|
||||||
return [fake.FakeBoot]
|
return [fake.FakeBoot] + super().supported_boot_interfaces
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_console_interfaces(self):
|
def supported_console_interfaces(self):
|
||||||
"""List of classes of supported console interfaces."""
|
"""List of classes of supported console interfaces."""
|
||||||
return [fake.FakeConsole, noop.NoConsole]
|
return [fake.FakeConsole] + super().supported_console_interfaces
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_deploy_interfaces(self):
|
def supported_deploy_interfaces(self):
|
||||||
"""List of classes of supported deploy interfaces."""
|
"""List of classes of supported deploy interfaces."""
|
||||||
return [fake.FakeDeploy]
|
return [fake.FakeDeploy] + super().supported_deploy_interfaces
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_inspect_interfaces(self):
|
def supported_inspect_interfaces(self):
|
||||||
"""List of classes of supported inspect interfaces."""
|
"""List of classes of supported inspect interfaces."""
|
||||||
return [fake.FakeInspect, noop.NoInspect]
|
return [fake.FakeInspect] + super().supported_inspect_interfaces
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_management_interfaces(self):
|
def supported_management_interfaces(self):
|
||||||
@ -70,26 +68,21 @@ class FakeHardware(hardware_type.AbstractHardwareType):
|
|||||||
@property
|
@property
|
||||||
def supported_raid_interfaces(self):
|
def supported_raid_interfaces(self):
|
||||||
"""List of classes of supported raid interfaces."""
|
"""List of classes of supported raid interfaces."""
|
||||||
return [fake.FakeRAID, noop.NoRAID]
|
return [fake.FakeRAID] + super().supported_raid_interfaces
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_rescue_interfaces(self):
|
def supported_rescue_interfaces(self):
|
||||||
"""List of classes of supported rescue interfaces."""
|
"""List of classes of supported rescue interfaces."""
|
||||||
return [fake.FakeRescue, noop.NoRescue]
|
return [fake.FakeRescue] + super().supported_rescue_interfaces
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_storage_interfaces(self):
|
def supported_storage_interfaces(self):
|
||||||
"""List of classes of supported storage interfaces."""
|
"""List of classes of supported storage interfaces."""
|
||||||
return [fake.FakeStorage, noop_storage.NoopStorage]
|
return [fake.FakeStorage] + super().supported_storage_interfaces
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_vendor_interfaces(self):
|
def supported_vendor_interfaces(self):
|
||||||
"""List of classes of supported rescue interfaces."""
|
"""List of classes of supported rescue interfaces."""
|
||||||
return [fake.FakeVendorB, fake.FakeVendorA, noop.NoVendor]
|
return [
|
||||||
|
fake.FakeVendorB, fake.FakeVendorA
|
||||||
@property
|
] + super().supported_vendor_interfaces
|
||||||
def supported_network_interfaces(self):
|
|
||||||
# import late to avoid circular imports
|
|
||||||
from ironic.drivers.modules.network import flat
|
|
||||||
from ironic.drivers.modules.network import noop
|
|
||||||
return [flat.FlatNetwork, noop.NoopNetwork]
|
|
||||||
|
6
releasenotes/notes/fake-interfaces-9778071f6379227b.yaml
Normal file
6
releasenotes/notes/fake-interfaces-9778071f6379227b.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
other:
|
||||||
|
- |
|
||||||
|
The ``fake-hardware`` hardware types now explicitly declares support
|
||||||
|
for all generic interface implementations, so that they can be used
|
||||||
|
in the defaults calculation.
|
Loading…
x
Reference in New Issue
Block a user