Support ocata release of ironic
In the Ocata release, the physical_network field of ports did not exist. The safest thing to do is to simply ignore it in this case. It is also possible for the local_link_connection fields to not have switch_id, switch_info or port_id attributes, so we now use .get(attr) to avoid an attribute lookup error. Change-Id: Ib4829dbd89fcedc121f493d6af76702421b399f7 TrivialFix
This commit is contained in:
parent
60ffdc13ed
commit
1a0d953737
@ -26,6 +26,20 @@
|
||||
until: result is success
|
||||
retries: 3
|
||||
|
||||
- name: Detect ironic API version
|
||||
command: >-
|
||||
{{ ironic_virtualenv_path }}/bin/openstack
|
||||
--os-baremetal-api-version 1.34
|
||||
baremetal node list
|
||||
register: api_version_result
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
# This is used in port.yml.
|
||||
- name: Set a fact about whether Ironic supports physical network awareness
|
||||
set_fact:
|
||||
supports_port_physnet: "{{ api_version_result.rc == 0 }}"
|
||||
|
||||
# This command will return the UUIDs, regardless of whether
|
||||
# ironic_deploy_kernel and ironic_deploy_ramdisk are image UUIDs or names.
|
||||
- name: Get OpenStack deployment image UUIDs
|
||||
|
@ -40,12 +40,14 @@
|
||||
command: >-
|
||||
'{{ ironic_virtualenv_path }}/bin/openstack' baremetal port set
|
||||
{{ uuid.stdout }}
|
||||
{% if supports_port_physnet %}
|
||||
--physical-network '{{ physnet }}'
|
||||
{% endif %}
|
||||
--local-link-connection switch_id='{{ switch_id }}'
|
||||
--local-link-connection switch_info='{{ bridge }}'
|
||||
--local-link-connection port_id='{{ port_id }}'
|
||||
when: >-
|
||||
port_attributes.physical_network != physnet or
|
||||
port_attributes.local_link_connection.switch_id != switch_id or
|
||||
port_attributes.local_link_connection.switch_info != switch_info or
|
||||
port_attributes.local_link_connection.port_id != port_id
|
||||
(supports_port_physnet and port_attributes.physical_network != physnet) or
|
||||
port_attributes.local_link_connection.get('switch_id') != switch_id or
|
||||
port_attributes.local_link_connection.get('switch_info') != switch_info or
|
||||
port_attributes.local_link_connection.get('port_id') != port_id
|
||||
|
Loading…
Reference in New Issue
Block a user