-
Notifications
You must be signed in to change notification settings - Fork 9
feat(ironic-understack): stub hardware type for network devices #2095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+136
−24
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Ironic | ||
|
|
||
| ## Custom Hardware Types | ||
|
|
||
| UnderStack ships additional Ironic hardware types via the `ironic-understack` | ||
| Python package, registered as `ironic.hardware.types` entry points. | ||
|
|
||
| ### netdev | ||
|
|
||
| The `netdev` hardware type is a stub type for network devices (firewalls, | ||
| load balancers) that Ironic tracks solely for Neutron physical port binding. It uses | ||
| noop or no-* interfaces for everything except `network`, which is set to | ||
| `neutron`. This means nodes of this type go through no deployment, inspection, | ||
| BIOS, RAID, rescue, or firmware lifecycle — Ironic only manages their port | ||
| bindings. | ||
|
|
||
| To use it, add `netdev` to `enabled_hardware_types` in `ironic.conf` and | ||
| ensure `noop` deploy and `neutron` network interfaces are also enabled. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
python/ironic-understack/ironic_understack/netdev_hardware.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| from ironic.drivers import generic | ||
| from ironic.drivers.modules import noop | ||
| from ironic.drivers.modules.network import neutron | ||
| from ironic.drivers.modules.storage import noop as noop_storage | ||
|
|
||
|
|
||
| class NetdevHardware(generic.ManualManagementHardware): | ||
| """Hardware type for network devices. | ||
|
|
||
| Intended for nodes that represent network infrastructure (e.g. switches, | ||
| routers). Deploy is intentionally a no-op; Neutron is the only supported | ||
| network interface. All other interfaces use the no-* noop variants. | ||
|
|
||
| Boot, power, and management are inherited from ManualManagementHardware | ||
| (NoopManagement / FakePower / iPXE+PXE boot) because Ironic has no | ||
| NoBoot or NoPower equivalents. | ||
| """ | ||
|
|
||
| @property | ||
| def supported_bios_interfaces(self): | ||
| return [noop.NoBIOS] | ||
|
|
||
| @property | ||
| def supported_console_interfaces(self): | ||
| return [noop.NoConsole] | ||
|
|
||
| @property | ||
| def supported_deploy_interfaces(self): | ||
| return [noop.NoDeploy] | ||
|
|
||
| @property | ||
| def supported_firmware_interfaces(self): | ||
| return [noop.NoFirmware] | ||
|
|
||
| @property | ||
| def supported_inspect_interfaces(self): | ||
| return [noop.NoInspect] | ||
|
|
||
| @property | ||
| def supported_network_interfaces(self): | ||
| return [neutron.NeutronNetwork] | ||
|
|
||
| @property | ||
| def supported_raid_interfaces(self): | ||
| return [noop.NoRAID] | ||
|
|
||
| @property | ||
| def supported_rescue_interfaces(self): | ||
| return [noop.NoRescue] | ||
|
|
||
| @property | ||
| def supported_storage_interfaces(self): | ||
| return [noop_storage.NoopStorage] | ||
|
|
||
| @property | ||
| def supported_vendor_interfaces(self): | ||
| return [noop.NoVendor] |
34 changes: 34 additions & 0 deletions
34
python/ironic-understack/ironic_understack/tests/test_netdev_hardware.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| from ironic.drivers.modules import noop | ||
| from ironic.drivers.modules.storage import noop as noop_storage | ||
|
|
||
| from ironic_understack.netdev_hardware import NetdevHardware | ||
|
|
||
|
|
||
| def _interface_names(ifaces): | ||
| return [cls.__name__ for cls in ifaces] | ||
|
|
||
|
|
||
| def test_netdev_deploy(): | ||
| hw = NetdevHardware() | ||
| assert _interface_names(hw.supported_deploy_interfaces) == ["NoDeploy"] | ||
|
|
||
|
|
||
| def test_netdev_bios(): | ||
| hw = NetdevHardware() | ||
| assert _interface_names(hw.supported_bios_interfaces) == ["NoBIOS"] | ||
|
|
||
|
|
||
| def test_netdev_network(): | ||
| hw = NetdevHardware() | ||
| assert _interface_names(hw.supported_network_interfaces) == ["NeutronNetwork"] | ||
|
|
||
|
|
||
| def test_netdev_noop_interfaces(): | ||
| hw = NetdevHardware() | ||
| assert hw.supported_console_interfaces == [noop.NoConsole] | ||
| assert hw.supported_firmware_interfaces == [noop.NoFirmware] | ||
| assert hw.supported_inspect_interfaces == [noop.NoInspect] | ||
| assert hw.supported_raid_interfaces == [noop.NoRAID] | ||
| assert hw.supported_rescue_interfaces == [noop.NoRescue] | ||
| assert hw.supported_storage_interfaces == [noop_storage.NoopStorage] | ||
| assert hw.supported_vendor_interfaces == [noop.NoVendor] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.