Default Ironic node properties are bogus

Unless you add a 'properties' field under the 'ironic_config' for a node spec,
ironic nodes are registered with silly default properties (originating in the
os_ironic module) which cause validation to fail:

cpus:1, memory_mb: 1, local_gb: 1

We have enough info to add sensible defaults based on the VM configuration, so
let's do that.

Change-Id: I43fbe726d1d787d96be811f3ecd4234ea3b6bac3
Story: 2004908
Task: 29258
This commit is contained in:
Mark Goddard 2019-01-31 14:47:36 +00:00
parent 7ad354c2af
commit c58a22a2b1
2 changed files with 20 additions and 2 deletions

View File

@ -87,10 +87,21 @@
--{{ iface }}-interface {{ node.ironic_config[iface + '_interface'] }}
{% endif %}
{% endfor %}
{% for key, val in (
node.ironic_config.properties | default({})).iteritems() %}
{% for key, val in properties.iteritems() %}
--property '{{ key }}={{ val }}'
{% endfor %}
vars:
properties: "{{ default_properties | combine(custom_properties) }}"
custom_properties: "{{ node.ironic_config.get('properties', {}) }}"
# Although properties are not required for scheduling, the os_ironic module
# adds silly defaults that cause the validation API call to fail,
# preventing deployment. We add them here because the os_ironic module
# uses unusual names (cpus, ram, disk_size) for scheduling properties,
# and doesn't support setting other properties.
default_properties:
cpus: "{{ node.vcpus }}"
memory_mb: "{{ node.memory_mb }}"
local_gb: "{{ node.volumes[0].capacity | size_string_to_gb if node.volumes | length > 0 else 0 }}"
- name: Add Ironic node traits
command: >-

View File

@ -0,0 +1,7 @@
---
features:
- |
Adds support for setting default properties on ironic nodes. This avoids an
issue where nodes are registered with the standard scheduling properties
all set to 1, causing ironic validation failures. See `story 2004908
<https://storyboard.openstack.org/#!/story/2004908>`__ for details.