Add support for neutron network names for cleaning/provisioning

This patch adds the ability to specify a cleaning and provisioning
network for Ironic. If none are specified then Ironic continues to
function as it does now.

Ironic role will calculate the UUID of the neutron network assuming a
network name is provided.

Additionally, this is added to testing by configuring a network to add
with the network-name.

Change-Id: I9be6f351c0da292ac8b861d2168e73d1861e1603
This commit is contained in:
Andy McCrae 2016-12-08 12:40:58 +00:00
parent de48a822e8
commit 9f084a910c
13 changed files with 188 additions and 29 deletions

View File

@ -102,7 +102,19 @@ ironic_galera_database: ironic
## Keystone authentication middleware
ironic_keystone_auth_plugin: password
# Neutron network - Set these in a playbook/task - can be set manually.
# Only "name" or "uuid" is needed, uuid will take preference if both are specified.
# The cleaning network is not required to be set - it will default to the same as
# the provisioning network if not specified.
# ironic_neutron_provisioning_network_uuid: "UUID for provisioning network in neutron"
# ironic_neutron_cleaning_network_uuid: "UUID for cleaning network in neutron"
# ironic_neutron_provisioning_network_name: "Name of provisioning network in neutron"
# ironic_neutron_cleaning_network_name: "Name of cleaning network in neutron"
# Integrated Openstack configuration
ironic_openstack_driver_list: "pxe_ipmitool, agent_ipmitool"
ironic_enabled_network_interfaces_list: "flat,noop{{ (ironic_neutron_provisioning_network_uuid is defined) | ternary(',neutron','') }}"
ironic_default_network_interface: "{{ (ironic_neutron_provisioning_network_uuid is defined) | ternary('neutron','flat') }}"
ironic_openstack_driver_list: agent_ipmitool
ironic_openstack_auth_strategy: keystone
ironic_openstack_api_url: '' # Not required when we have keystone

View File

@ -0,0 +1,17 @@
features:
- Add support for ``neutron`` as an
``enabled_network_interface``.
- The ``ironic_neutron_provisioning_network_name`` and
``ironic_neutron_cleaning_network_name`` variable can
be set to the name of the neutron network to use for
provisioning and cleaning. The ansible tasks will
determine the appropriate UUID for that network.
Alternatively,
``ironic_neutron_provisioning_network_uuid`` or
``ironic_neutron_cleaning_network`` can be used to
directly specify the UUID of the networks. If both
``ironic_neutron_provisioning_network_name`` and
``ironic_neutron_provisioning_network_uuid`` are
specified, the specified UUID will be used.
If only the provisioning network is specified, the
cleaning network will default to the same network.

View File

@ -0,0 +1,41 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install neutronclient
pip:
name: python-neutronclient
state: "{{ ironic_pip_package_state }}"
extra_args: "{{ pip_install_options | default('') }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
- name: Create neutron network
neutron:
command: get_networks
net_name: "{{ ironic_neutron_provisioning_network_name }}"
openrc_path: /root/openrc
- name: Set provisioning UUID fact
set_fact:
ironic_neutron_provisioning_network_uuid: "{{ neutron_networks[ironic_neutron_provisioning_network_name].id }}"
- name: Set cleaning UUID fact
set_fact:
ironic_neutron_cleaning_network_uuid: "{{ neutron_networks[ironic_neutron_cleaning_network_name].id"
when:
- ironic_neutron_cleaning_network_name is defined
- ironic_neutron_cleaning_network_uuid is not defined

View File

@ -102,6 +102,14 @@
tags:
- always
# Get the cleaning/provisioning network UUIDs
- include: ironic_get_neutron_uuids.yml
when:
- ironic_neutron_provisioning_network_uuid is not defined
- ironic_neutron_provisioning_network_name is defined
tags:
- always
- name: Generate ironic config
config_template:
src: "{{ item.src }}"

View File

@ -10,6 +10,8 @@ enabled_drivers = {{ ironic_driver_list }}
host = {{ inventory_hostname }}
memcached_servers = {{ memcached_servers }}
enabled_network_interfaces = {{ ironic_enabled_network_interfaces_list }}
default_network_interface = {{ ironic_default_network_interface }}
[agent]
@ -114,6 +116,10 @@ project_domain_name = {{ neutron_service_domain_name |default("Default") }}
# Keystone client plugin authentication URL option
auth_url = {{ keystone_service_adminurl }}
insecure = {{ keystone_service_adminuri_insecure | bool }}
{% if ironic_neutron_provisioning_network_name is defined %}
provisioning_network_uuid = {{ ironic_neutron_provisioning_network_uuid | default('') }}
cleaning_network_uuid = {{ ironic_neutron_cleaning_network_uuid | default(ironic_neutron_provisioning_network_uuid | default('')) }}
{% endif %}
[oneview]

View File

@ -16,12 +16,7 @@
ansible_host: 10.1.1.104
ansible_become: True
ansible_user: root
tunnel_address: 10.1.2.104
neutron_local_ip: 10.1.2.104
neutron_provider_networks:
network_types: "vxlan,flat"
network_mappings: "flat:eth12"
network_vxlan_ranges: "1:1000"
ipmi_address: 10.1.4.104
container_name: "{{ inventory_hostname }}"
container_networks:
management_address:
@ -30,14 +25,14 @@ container_networks:
interface: "eth1"
netmask: "255.255.255.0"
type: "veth"
tunnel_address:
address: "{{ tunnel_address }}"
bridge: "br-vxlan"
ipmi_address:
address: "{{ ipmi_address }}"
bridge: "br-ipmi"
interface: "eth2"
netmask: "255.255.255.0"
type: "veth"
vlan_address:
bridge: "br-vlan"
interface: "eth12"
prov_address:
bridge: "br-prov"
interface: "eth11"
netmask: null
type: "veth"

View File

@ -13,10 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
neutron_provider_networks:
network_types: "vxlan,flat"
network_mappings: "flat:eth12"
network_vxlan_ranges: "1:1000"
ansible_become: True
neutron_local_ip: 10.1.2.1
ansible_python_interpreter: "/usr/bin/python2"
@ -25,6 +21,13 @@ bridges:
ip_addr: "10.1.1.1"
- name: "br-vxlan"
ip_addr: "10.1.2.1"
- name: "br-vlan"
- name: "br-flat"
ip_addr: "10.1.3.1"
veth_peer: "eth12"
- name: "br-ipmi"
ip_addr: "10.1.4.1"
- name: "br-storage"
ip_addr: "10.1.5.1"
- name: "br-prov"
ip_addr: "10.1.6.1"
veth_peer: "eth11"

View File

@ -18,10 +18,7 @@ ansible_become: True
ansible_user: root
tunnel_address: 10.1.2.102
neutron_local_ip: 10.1.2.102
neutron_provider_networks:
network_types: "vxlan,flat"
network_mappings: "flat:eth12"
network_vxlan_ranges: "1:1000"
storage_address: 10.1.5.102
container_name: "{{ inventory_hostname }}"
container_networks:
management_address:
@ -36,8 +33,19 @@ container_networks:
interface: "eth2"
netmask: "255.255.255.0"
type: "veth"
vlan_address:
bridge: "br-vlan"
interface: "eth12"
storage_address:
address: "{{ storage_address }}"
bridge: "br-storage"
interface: "eth3"
netmask: "255.255.255.0"
type: "veth"
prov_address:
bridge: "br-prov"
interface: "eth11"
netmask: null
type: "veth"
flat_address:
bridge: "br-flat"
interface: "eth12"
netmask: null
type: veth

View File

@ -14,7 +14,7 @@
# limitations under the License.
ansible_host: 10.1.1.103
storage_address: 10.1.2.103
storage_address: 10.1.5.103
ansible_user: root
ansible_become: True
container_networks:
@ -26,7 +26,7 @@ container_networks:
type: "veth"
storage_address:
address: "{{ storage_address }}"
bridge: "br-vxlan"
interface: "eth2"
bridge: "br-storage"
interface: "eth3"
netmask: "255.255.255.0"
type: "veth"

View File

@ -100,7 +100,7 @@ openstack1
openstack1
[nova_compute]
localhost
openstack1
[nova_conductor]
openstack1

View File

@ -13,7 +13,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
test_swift_repl_network: "eth2"
test_swift_storage_network: "eth3"
test_swift_repl_network: "eth3"
nova_virt_type: ironic
glance_file_store: swift
test_swift_repl_number: 2
nova_console_type: novnc
neutron_provider_networks:
network_types: "vxlan,flat"
network_vxlan_ranges: "1:1000"
network_flat_networks: "flat,prov"
network_mappings: "flat:eth12,prov:eth11"
# Must be set to a normal MTU
neutron_network_device_mtu: 1500
neutron_l2_population: True
neutron_dhcp_config:
dhcp-option-force: "26,1500"
log-facility: "/var/log/neutron/neutron-dnsmasq.log"
ironic_neutron_provisioning_network_name: "ironic-prov"
neutron_l3: True
neutron_metadata: True
ironic_pip_package_state: latest

View File

@ -0,0 +1,47 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Setup localhost requirements
hosts: localhost
become: True
gather_facts: True
tasks:
- name: Install pip requirements
pip:
name: "python-neutronclient"
state: "{{ ironic_pip_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
- name: Create br-prov network
neutron:
command: create_network
openrc_path: /root/openrc
net_name: "{{ ironic_neutron_provisioning_network_name }}"
provider_network_type: flat
provider_physical_network: prov
insecure: "{{ keystone_service_internaluri_insecure }}"
- name: Ensure public subnet exists
neutron:
command: create_subnet
openrc_path: /root/openrc
net_name: "{{ ironic_neutron_provisioning_network_name }}"
subnet_name: "ironic-prov-subnet"
cidr: "10.1.6.0/24"
insecure: "{{ keystone_service_internaluri_insecure }}"
allocation_pools: ""
vars_files:
- common/test-vars.yml

View File

@ -34,6 +34,9 @@
# Install Nova
- include: common/test-install-nova.yml
# Configure Ironic
- include: test-configure-ironic.yml
# Install Ironic
- include: common/test-install-ironic.yml