From 2cf50d4d1deb331bc07d6890e114d6314d117940 Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Mon, 12 Sep 2016 11:16:12 +0300 Subject: [PATCH] Update ironic node names for multinode case Ironic node name is unique. This patch updates _ironic_bm_names() function to generate uniq name for primary and subnodes. On primary node node name is node-{id}. On subnode node name is subnode-{id}. Where {id} is the node number from 0 to $IRONIC_VM_COUNT Related-Bug: #1622653 Change-Id: I7898426982b9fd89ac654a32e5d0b46d2a83dfcb --- devstack/lib/ironic | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 9820fb4ab9..63d2acf236 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -871,7 +871,7 @@ function _ironic_bm_vm_names { local num_vms num_vms=$(($IRONIC_VM_COUNT - 1)) for idx in $(seq 0 $num_vms); do - echo "node-${idx}" + echo "$(get_ironic_node_prefix)-${idx}" done } @@ -1059,6 +1059,9 @@ function enroll_nodes { chassis_id=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2) die_if_not_set $LINENO chassis_id "Failed to create chassis" + local node_prefix + node_prefix=$(get_ironic_node_prefix) + if [[ "$IRONIC_IS_HARDWARE" == "False" ]]; then local ironic_node_cpu=$IRONIC_VM_SPECS_CPU local ironic_node_ram=$IRONIC_VM_SPECS_RAM @@ -1197,7 +1200,7 @@ function enroll_nodes { node_id=$(ironic node-create $standalone_node_uuid\ --chassis_uuid $chassis_id \ --driver $IRONIC_DEPLOY_DRIVER \ - --name node-$total_nodes \ + --name $node_prefix-$total_nodes \ -p cpus=$ironic_node_cpu\ -p memory_mb=$ironic_node_ram\ -p local_gb=$ironic_node_disk\ @@ -1561,6 +1564,14 @@ function ironic_configure_tempest { iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid } +function get_ironic_node_prefix { + local node_prefix="node" + if [[ "$HOST_TOPOLOGY_ROLE" == "subnode" ]]; then + node_prefix="$HOST_TOPOLOGY_ROLE" + fi + echo $node_prefix +} + # Restore xtrace + pipefail $_XTRACE_IRONIC $_PIPEFAIL_IRONIC