From 33d79b09a94faf8fbde339ddf8e4ae978c332aa7 Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Thu, 12 May 2016 20:47:55 -0700 Subject: [PATCH] Config drive spec uses network_data.json The filename was incorrectly implemented as network_info.json instead of network_data.json. Support for reading the correct file already exists in glean. As such, we need to write both files for user compatability in the short term, and remove the second file at a later point in time. A release note has been added detailing this as well. Co-Authored-By: Julia Kreger Change-Id: I4150f86fbc141dcd6fd12094acab1ca43d76910c --- README.rst | 2 +- playbooks/library/network_metadata.py | 4 ++-- .../bifrost-configdrives-dynamic/README.md | 4 ++-- .../defaults/main.yml | 3 +++ .../tasks/main.yml | 18 ++++++++++++++---- ...twork_info.json.j2 => network_data.json.j2} | 0 ...ate_node_network_info-8c5e1bc4df6b8097.yaml | 17 +++++++++++++++++ 7 files changed, 39 insertions(+), 9 deletions(-) rename playbooks/roles/bifrost-configdrives-dynamic/templates/{network_info.json.j2 => network_data.json.j2} (100%) create mode 100644 releasenotes/notes/deprecate_node_network_info-8c5e1bc4df6b8097.yaml diff --git a/README.rst b/README.rst index 8bd58478b..52a244758 100644 --- a/README.rst +++ b/README.rst @@ -448,7 +448,7 @@ Deployment and configuration of operating systems By default, Bifrost deploys a configuration drive which includes the user SSH public key, hostname, and the network configuration in the form of -network_info.json that can be read/parsed by the +network_data.json that can be read/parsed by the `glean `_ utility. This allows for the deployment of Ubuntu, CentOS, or Fedora "tenants" on baremetal. This file format is not yet supported by Cloud-Init, however it is on track for diff --git a/playbooks/library/network_metadata.py b/playbooks/library/network_metadata.py index f68aed16b..9c6e91f9a 100644 --- a/playbooks/library/network_metadata.py +++ b/playbooks/library/network_metadata.py @@ -34,12 +34,12 @@ def main(): vlan_id=dict(required=False), network_mtu=dict(required=False), nics=dict(required=False, type='list'), - node_network_info=dict(required=False, type='dict') + node_network_data=dict(required=False, type='dict') ) module = AnsibleModule(argument_spec) - network_metadata = module.params['node_network_info'] + network_metadata = module.params['node_network_data'] if not network_metadata: links = [] networks = [] diff --git a/playbooks/roles/bifrost-configdrives-dynamic/README.md b/playbooks/roles/bifrost-configdrives-dynamic/README.md index 98fc11820..2bcecf884 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/README.md +++ b/playbooks/roles/bifrost-configdrives-dynamic/README.md @@ -53,8 +53,8 @@ write_interfaces_file: Legacy option to write an debian style network interfaces configuration file. This is required for deployment where simple-init cannot be used, in particular when using Cirros. -node_network_info: Optional: If defined, the contents are written out to the - network_info.json file, effectively allowing a user to +node_network_data: Optional: If defined, the contents are written out to the + network_data.json file, effectively allowing a user to override the network configuration contents based on the inventory data. diff --git a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml index 46b32a6f0..e33e95815 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml @@ -24,3 +24,6 @@ ironic_url: "http://localhost:6385/" # Default ISO generation utility iso_gen_utility: "mkisofs" + +# Deprecated, remove in Queens release +node_network_info: {} diff --git a/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml b/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml index d2c0ee826..9126973d8 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml +++ b/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml @@ -45,7 +45,7 @@ src: openstack_meta_data.json.j2 dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/meta_data.json" -- name: "Generate network_info" +- name: "Generate network_data" network_metadata: ipv4_address: "{{ ipv4_address | default('') }}" ipv4_gateway: "{{ ipv4_gateway | default('') }}" @@ -55,12 +55,22 @@ vlan_id: "{{ vlan_id | default('') }}" network_mtu: "{{ network_mtu | default('1500') }}" nics: "{{ nics | default(omit) }}" - node_network_info: "{{ node_network_info | default({}) }}" + node_network_data: "{{ node_network_data | default(node_network_info) }}" when: addressing_mode is undefined or "dhcp" not in addressing_mode -- name: "Place network info template in each openstack/latest folder" +- name: "Place network data template in each openstack/latest folder" template: - src: network_info.json.j2 + src: network_data.json.j2 + dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/network_data.json" + when: addressing_mode is undefined or "dhcp" not in addressing_mode + +# TODO(TheJulia): Deprecation removal of the old network_info file name +# should likely take place after an elongated deprecation cycle. +# Begind eprecated in the Ocata release suggests Queens as the point +# in which we should remove it. +- name: "Place deprecated network info file location in each openstack/latest folder" + template: + src: network_data.json.j2 dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/network_info.json" when: addressing_mode is undefined or "dhcp" not in addressing_mode diff --git a/playbooks/roles/bifrost-configdrives-dynamic/templates/network_info.json.j2 b/playbooks/roles/bifrost-configdrives-dynamic/templates/network_data.json.j2 similarity index 100% rename from playbooks/roles/bifrost-configdrives-dynamic/templates/network_info.json.j2 rename to playbooks/roles/bifrost-configdrives-dynamic/templates/network_data.json.j2 diff --git a/releasenotes/notes/deprecate_node_network_info-8c5e1bc4df6b8097.yaml b/releasenotes/notes/deprecate_node_network_info-8c5e1bc4df6b8097.yaml new file mode 100644 index 000000000..ae4ba090c --- /dev/null +++ b/releasenotes/notes/deprecate_node_network_info-8c5e1bc4df6b8097.yaml @@ -0,0 +1,17 @@ +--- +deprecations: + - The ``node_network_info`` parameter has been deperecated + in favor for the ``node_network_data`` parameter as the + relaated configurtion drive ``network_info.json`` file was + misnamed origionally, and should have been named + ``network_data.json``. + Support for the node_network_info, and the continued + write-out of the network_info.json file in configuration + drives will be removed in the Queens cycle. +fixes: + - When support for passing configuration drive data to the + nodes was originally created, the file was accidently named + incorrectly as ``network_info.json``. The correct filename + is ``network_data.json``. Both files will now be written + until support for writing ``network_info.json`` is removed + in the Queens cycle.