Stop using sub-sections of driver_info

They are deprecated in the ansible collection and do not match ironic.

Change-Id: I42b4e6f1c76b966d870297aa568a3e81d1967bc1
This commit is contained in:
Dmitry Tantsur 2022-01-25 16:11:20 +01:00
parent a4657cc600
commit 73df7ea137
10 changed files with 70 additions and 76 deletions

View File

@ -1,4 +1,4 @@
collections: collections:
- name: openstack.cloud - name: openstack.cloud
version: '>=1.0.0,<2.0.0' version: '>=1.3.0,<2.0.0'
source: https://galaxy.ansible.com source: https://galaxy.ansible.com

View File

@ -95,14 +95,12 @@ Example JSON Element:
"neutron" "neutron"
], ],
"driver_info": { "driver_info": {
"power": {
"ipmi_target_channel": "0", "ipmi_target_channel": "0",
"ipmi_username": "ADMIN", "ipmi_username": "ADMIN",
"ipmi_address": "192.168.122.1", "ipmi_address": "192.168.122.1",
"ipmi_target_address": "0", "ipmi_target_address": "0",
"ipmi_password": "undefined", "ipmi_password": "undefined",
"ipmi_bridging": "single" "ipmi_bridging": "single"
}
}, },
"nics": [ "nics": [
{ {

View File

@ -37,17 +37,17 @@ class TestBifrostInventoryFunctional(base.TestCase):
{"uuid": "00000000-0000-0000-0000-000000000002", "driver": "ipmi", {"uuid": "00000000-0000-0000-0000-000000000002", "driver": "ipmi",
"name": "hostname1", "ipv4_address": "192.168.1.3", "ansible_ssh_host": "name": "hostname1", "ipv4_address": "192.168.1.3", "ansible_ssh_host":
"192.168.1.3", "provisioning_ipv4_address": "192.168.1.3", "192.168.1.3", "provisioning_ipv4_address": "192.168.1.3",
"driver_info": {"power": {"ipmi_address": "192.0.2.3", "driver_info": {"ipmi_address": "192.0.2.3",
"ipmi_password": "undefined", "ipmi_username": "root", "ipmi_password": "undefined", "ipmi_username": "root",
"ipmi_target_address": null, "ipmi_target_channel": null, "ipmi_target_address": null, "ipmi_target_channel": null,
"ipmi_transit_address": null, "ipmi_transit_channel": null}}, "nics": "ipmi_transit_address": null, "ipmi_transit_channel": null}, "nics":
[{"mac": "00:01:02:03:04:06"}], "properties": {"ram": "8192", "cpu_arch": [{"mac": "00:01:02:03:04:06"}], "properties": {"ram": "8192", "cpu_arch":
"x86_64", "disk_size": "1024", "cpus": "2"}, "host_groups": "x86_64", "disk_size": "1024", "cpus": "2"}, "host_groups":
["baremetal", "nova"]}, "hostname0": ["baremetal", "nova"]}, "hostname0":
{"uuid": "00000000-0000-0000-0000-000000000001", "driver": "ipmi", {"uuid": "00000000-0000-0000-0000-000000000001", "driver": "ipmi",
"name": "hostname0", "ipv4_address": "192.168.1.2", "ansible_ssh_host": "name": "hostname0", "ipv4_address": "192.168.1.2", "ansible_ssh_host":
"192.168.1.2", "provisioning_ipv4_address": "192.168.1.2", "192.168.1.2", "provisioning_ipv4_address": "192.168.1.2",
"driver_info": {"power": {}}, "nics": "driver_info": {}, "nics":
[{"mac": "00:01:02:03:04:05"}], "properties": {"ram": "8192", [{"mac": "00:01:02:03:04:05"}], "properties": {"ram": "8192",
"cpu_arch": "x86_64", "disk_size": "512", "cpus": "1"}, "cpu_arch": "x86_64", "disk_size": "512", "cpus": "1"},
"host_groups": ["baremetal", "nova"]}}""".replace('\n', '') "host_groups": ["baremetal", "nova"]}}""".replace('\n', '')
@ -59,12 +59,12 @@ class TestBifrostInventoryFunctional(base.TestCase):
def test_minimal_json(self): def test_minimal_json(self):
input_json = """{"h0000-01":{"uuid": input_json = """{"h0000-01":{"uuid":
"00000000-0000-0000-0001-bad00000010","name":"h0000-01","driver_info" "00000000-0000-0000-0001-bad00000010","name":"h0000-01","driver_info"
:{"power":{"ipmi_address":"10.0.0.78","ipmi_username":"ADMIN"," :{"ipmi_address":"10.0.0.78","ipmi_username":"ADMIN","
ipmi_password":"ADMIN"}},"driver":"ipmi"}}""".replace('\n', '') ipmi_password":"ADMIN"},"driver":"ipmi"}}""".replace('\n', '')
expected_json = """{"h0000-01":{"uuid": expected_json = """{"h0000-01":{"uuid":
"00000000-0000-0000-0001-bad00000010","name":"h0000-01","driver_info" "00000000-0000-0000-0001-bad00000010","name":"h0000-01","driver_info"
:{"power":{"ipmi_address":"10.0.0.78","ipmi_username":"ADMIN"," :{"ipmi_address":"10.0.0.78","ipmi_username":"ADMIN","
ipmi_password":"ADMIN"}},"driver":"ipmi","addressing_mode": ipmi_password":"ADMIN"},"driver":"ipmi","addressing_mode":
"dhcp","host_groups": ["baremetal"]}}""".replace('\n', '') "dhcp","host_groups": ["baremetal"]}}""".replace('\n', '')
(groups, hostvars) = utils.bifrost_data_conversion(input_json) (groups, hostvars) = utils.bifrost_data_conversion(input_json)
del hostvars['127.0.0.1'] del hostvars['127.0.0.1']

View File

@ -89,7 +89,7 @@ The JSON format resembles the data structure that ironic utilizes internally.
``deploy``, ``management`` and ``console``. ``deploy``, ``management`` and ``console``.
.. note:: .. note::
With newer versions of the collection you can just put all fields under With newer versions of the collection you should just put all fields under
``driver_info`` directly). ``driver_info`` directly).
* The ``nics`` field is a list of ports to create. The required field is * The ``nics`` field is a list of ports to create. The required field is
@ -106,11 +106,9 @@ Example:
"testvm1": { "testvm1": {
"uuid": "00000000-0000-0000-0000-000000000001", "uuid": "00000000-0000-0000-0000-000000000001",
"driver_info": { "driver_info": {
"power": {
"ipmi_address": "192.168.122.1", "ipmi_address": "192.168.122.1",
"ipmi_username": "admin", "ipmi_username": "admin",
"ipmi_password": "pa$$w0rd" "ipmi_password": "pa$$w0rd"
}
}, },
"nics": [ "nics": [
{ {
@ -142,11 +140,9 @@ in an ``instance_info`` variable, for example:
"testvm1": { "testvm1": {
"uuid": "00000000-0000-0000-0000-000000000001", "uuid": "00000000-0000-0000-0000-000000000001",
"driver_info": { "driver_info": {
"power": {
"ipmi_address": "192.168.122.1", "ipmi_address": "192.168.122.1",
"ipmi_username": "admin", "ipmi_username": "admin",
"ipmi_password": "pa$$w0rd" "ipmi_password": "pa$$w0rd"
}
}, },
"nics": [ "nics": [
{ {

View File

@ -2,11 +2,9 @@
"basicipmiexample0": { "basicipmiexample0": {
"uuid": "00000000-0000-0000-0000-000000000002", "uuid": "00000000-0000-0000-0000-000000000002",
"driver_info": { "driver_info": {
"power": {
"ipmi_username": "ADMIN", "ipmi_username": "ADMIN",
"ipmi_address": "192.168.2.20", "ipmi_address": "192.168.2.20",
"ipmi_password": "ADMIN_PASSWORD" "ipmi_password": "ADMIN_PASSWORD"
}
}, },
"nics": [ "nics": [
{ {
@ -31,7 +29,6 @@
"ipa_ramdisk_url": "http://192.168.1.1:8080/custom_ipa.initramfs", "ipa_ramdisk_url": "http://192.168.1.1:8080/custom_ipa.initramfs",
"uuid": "00000000-0000-0000-0000-000000000003", "uuid": "00000000-0000-0000-0000-000000000003",
"driver_info": { "driver_info": {
"power": {
"ipmi_username": "ADMIN", "ipmi_username": "ADMIN",
"ipmi_address": "192.168.2.21", "ipmi_address": "192.168.2.21",
"ipmi_password": "ADMIN_PASSWORD", "ipmi_password": "ADMIN_PASSWORD",
@ -40,7 +37,6 @@
"ipmi_target_address": "1", "ipmi_target_address": "1",
"ipmi_transit_channel": "2", "ipmi_transit_channel": "2",
"ipmi_transit_address": "3" "ipmi_transit_address": "3"
}
}, },
"nics": [ "nics": [
{ {

View File

@ -2,7 +2,6 @@
basicipmiexample0: basicipmiexample0:
uuid: "00000000-0000-0000-0000-000000000002" uuid: "00000000-0000-0000-0000-000000000002"
driver_info: driver_info:
power:
ipmi_username: "ADMIN" ipmi_username: "ADMIN"
ipmi_address: "192.168.2.20" ipmi_address: "192.168.2.20"
ipmi_password: "ADMIN_PASSWORD" ipmi_password: "ADMIN_PASSWORD"
@ -24,7 +23,6 @@
ipa_ramdisk_url: "http://192.168.1.1:8080/custom_ipa.initramfs" ipa_ramdisk_url: "http://192.168.1.1:8080/custom_ipa.initramfs"
uuid: "00000000-0000-0000-0000-000000000003" uuid: "00000000-0000-0000-0000-000000000003"
driver_info: driver_info:
power:
ipmi_username: "ADMIN" ipmi_username: "ADMIN"
ipmi_address: "192.168.2.21" ipmi_address: "192.168.2.21"
ipmi_password: "ADMIN_PASSWORD" ipmi_password: "ADMIN_PASSWORD"

View File

@ -138,7 +138,6 @@
host_groups: "{{ vm_host_group }}" host_groups: "{{ vm_host_group }}"
driver: "{{ test_vm_node_driver }}" driver: "{{ test_vm_node_driver }}"
driver_info: driver_info:
power:
ipmi_address: "192.168.122.1" ipmi_address: "192.168.122.1"
ipmi_port: "{{ virtual_ipmi_port }}" ipmi_port: "{{ virtual_ipmi_port }}"
ipmi_username: "admin" ipmi_username: "admin"

View File

@ -42,21 +42,19 @@ cloud_name: Optional: String value defining a clouds.yaml entry for
the ansible module to leverage. the ansible module to leverage.
This role expects a data structure similar to the one below, however it should This role expects a data structure similar to the one below, however it should
be understood that the individual entries under power can vary based on power be understood that the individual entries under `driver_info` can vary based
driver required. on the driver.
{ {
"node1": { "node1": {
"uuid": "00000000-0000-0000-0000-000000000000", "uuid": "00000000-0000-0000-0000-000000000000",
"driver_info": { "driver_info": {
"power": {
"ipmi_target_channel": "0", "ipmi_target_channel": "0",
"ipmi_username": "ADMIN", "ipmi_username": "ADMIN",
"ipmi_address": "192.168.122.1", "ipmi_address": "192.168.122.1",
"ipmi_target_address": "0", "ipmi_target_address": "0",
"ipmi_password": "undefined", "ipmi_password": "undefined",
"ipmi_bridging": "single" "ipmi_bridging": "single"
}
}, },
"nics": [ "nics": [
{ {

View File

@ -32,5 +32,4 @@
state: present state: present
nics: "{{ nics }}" nics: "{{ nics }}"
properties: "{{ properties | default({}) }}" properties: "{{ properties | default({}) }}"
driver_info: driver_info: "{{ driver_info | default(omit) }}"
power: "{{ driver_info.power }}"

View File

@ -0,0 +1,10 @@
---
upgrade:
- |
In your inventory files, please remove sub-sections ``power``, ``console``
and ``management`` from ``driver_info``. Instead, just place all fields
under ``driver_info`` directly.
fixes:
- |
Bifrost no longer defaults to using sub-sections ``power``, ``console``
and ``management`` under ``driver_info`` in inventory.