Set interfaces and properties on Ironic nodes

Pass any interface that was specified through to Ironic; otherwise, let
Ironic decide a default for it. Also, pass through any property
key-value pairs we get.
This commit is contained in:
Will Miller 2018-09-07 14:06:43 +00:00
parent 8d1fe8266a
commit 94aee5d0ce
3 changed files with 34 additions and 43 deletions

View File

@ -41,13 +41,22 @@ node_types: {}
# resource_class: my_rc
# # Optional - defaults to [].
# traits: []
# # The following variables are all optional; if not set, a default will
# # be inferred from the `ironic_driver` specified by the node type
# # `type`.
# # A dict of key-value pairs to be set as properties on the Ironic
# # nodes. Can be used to set capabilities. Optional - defaults to {}.
# properties: {}
# # The following variables are all optional; if not set, Ironic's
# # default value will be used.
# bios_interface: no-bios
# boot_interface: pxe
# console_interface: ipmitool-socat
# deploy_interface: iscsi
# inspect_interface: inspector
# management_interface: ipmitool
# network_interface: neutron
# power_interface: ipmitool
# raid_interface: no-raid
# storage_interface: noop
# vendor_interface: ipmitool
specs: []
# nova_flavors is a list of Nova flavors to be created. Each flavor must
@ -82,34 +91,6 @@ allocations_file_path: >-
# The default Ironic driver of a node. Can be overridden per-node.
default_ironic_driver: ipmi
# Maps Ironic drivers to a dict containing default values for Ironic node
# interfaces. Any of these values can be overridden per-node.
default_interfaces:
ipmi:
bios_interface: no-bios
boot_interface: pxe
console_interface: ipmitool-socat
deploy_interface: iscsi
inspect_interface: inspector
management_interface: ipmitool
network_interface: neutron
power_interface: ipmitool
raid_interface: no-raid
storage_interface: noop
vendor_interface: ipmitool
# NOTE(w-miller): Redfish is not currently fully supported by Tenks.
redfish:
bios_interface: no-bios
boot_interface: pxe
console_interface: no-console
deploy_interface: iscsi
inspect_interface: inspector
management_interface: redfish
network_interface: neutron
power_interface: redfish
raid_interface: no-raid
storage_interface: noop
vendor_interface: no-vendor
# Maps BMC emulation tools to the Ironic driver they support.
bmc_emulators:

View File

@ -12,3 +12,16 @@ ironic_virtualenv_path:
# The URL of the upper constraints file to pass to pip when installing Python
# packages.
ironic_python_upper_constraints_url:
# A list of the interfaces that can be configured on an Ironic node.
ironic_interfaces:
- bios
- boot
- console
- deploy
- inspect
- management
- network
- power
- raid
- storage
- vendor

View File

@ -67,18 +67,15 @@
'{{ ironic_virtualenv_path }}/bin/openstack' baremetal node set
'{{ created_node.uuid }}'
--resource-class {{ node.ironic_config.resource_class }}
--boot-interface
{{ node.ironic_config.boot_interface | default(
default_interfaces[node.ironic_driver].boot_interface) }}
--deploy-interface
{{ node.ironic_config.deploy_interface | default(
default_interfaces[node.ironic_driver].deploy_interface) }}
--management-interface
{{ node.ironic_config.management_interface | default(
default_interfaces[node.ironic_driver].management_interface) }}
--power-interface
{{ node.ironic_config.power_interface | default(
default_interfaces[node.ironic_driver].power_interface) }}
{% for iface in ironic_interfaces %}
{% if (iface + '_interface') in node.ironic_config %}
--{{ iface }}-interface {{ node.ironic_config[iface + '_interface'] }}
{% endif %}
{% endfor %}
{% for key, val in (
node.ironic_config.properties | default({})).iteritems() %}
--property '{{ key }}={{ val }}'
{% endfor %}
- name: Add Ironic node traits
command: >-