From 58fbfabedaa18418415957b9f754c204dcceb3f1 Mon Sep 17 00:00:00 2001 From: vsaienko Date: Wed, 16 Mar 2016 15:16:28 +0200 Subject: [PATCH] Allow to use network interfaces in devstack This patch allow to set enabled_network_interfaces configuration option via IRONIC_ENABLED_NETWORK_INTERFACES and registered ironic node with IRONIC_NETWORK_INTERFACE. Change-Id: Ie01ca4be3a085bc283879b5528c5c174a35a843b Depends-On: I0c26582b6b6e9d32650ff3e2b9a3269c3c2d5454 Partial-bug: #1526403 --- devstack/lib/ironic | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 080672b7be..be36df84ee 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -212,6 +212,12 @@ IRONIC_TERMINAL_CERT_DIR=${IRONIC_TERMINAL_CERT_DIR:-$IRONIC_DATA_DIR/terminal_c # IRONIC_{VM,HW}_NODES_FILE IRONIC_USE_LINK_LOCAL=$(trueorfalse False IRONIC_USE_LINK_LOCAL) +# This flag is used to specify enabled network drivers +IRONIC_ENABLED_NETWORK_INTERFACES=${IRONIC_ENABLED_NETWORK_INTERFACES:-} + +# This is the network interface to use for a node +IRONIC_NETWORK_INTERFACE=${IRONIC_NETWORK_INTERFACE:-} + # get_pxe_boot_file() - Get the PXE/iPXE boot file path function get_pxe_boot_file { local relpath=syslinux/pxelinux.0 @@ -549,6 +555,10 @@ function configure_ironic_conductor { if [[ "$IRONIC_IS_HARDWARE" == "False" ]]; then iniset $IRONIC_CONF_FILE neutron port_setup_delay 15 fi + + if [[ -n "$IRONIC_ENABLED_NETWORK_INTERFACES" ]]; then + iniset $IRONIC_CONF_FILE DEFAULT enabled_network_interfaces $IRONIC_ENABLED_NETWORK_INTERFACES + fi } # create_ironic_cache_dir() - Part of the init_ironic() process @@ -911,6 +921,17 @@ function enroll_nodes { # Othervise API will return 406 ERROR ironic $ironic_api_version port-create --address $mac_address --node $node_id $llc_opts + # NOTE(vsaienko) use node-update instead of specifying network_interface + # during node creation. If node is added with latest version of API it + # will NOT go to available state automatically. + if [[ -n "${IRONIC_NETWORK_INTERFACE}" ]]; then + local n_id + ironic node-set-maintenance $node_id true + n_id=$(ironic $ironic_api_version node-update $node_id add network_interface=$IRONIC_NETWORK_INTERFACE) + die_if_not_set $LINENO n_id "Failed to update network interface for node" + ironic node-set-maintenance $node_id false + fi + total_nodes=$((total_nodes+1)) total_cpus=$((total_cpus+$ironic_node_cpu)) done < $ironic_hwinfo_file