summaryrefslogtreecommitdiff
path: root/devstack
diff options
context:
space:
mode:
authorJim Rollenhagen <jim@jimrollenhagen.com>2016-12-06 13:46:27 -0500
committerJim Rollenhagen <jim@jimrollenhagen.com>2017-01-31 09:39:10 -0500
commitee390e036f5785154ba0d7a0ad0e6a87f321a139 (patch)
tree59d4b4dad32ddbee907d5bd05fa209946de43ac3 /devstack
parentf3380855f7595b3176b1136e91cfafa165882585 (diff)
downloadironic-ee390e036f5785154ba0d7a0ad0e6a87f321a139.tar.gz
Allow using resource classes
Adds a variable IRONIC_USE_RESOURCE_CLASSES, which defaults to False. If true, it will set a resource_class for each node. This enables the code path in nova that registers the resource class with the placement engine and uses it in inventory. Change-Id: I785264eae0dc8ebe29f58a9e73f33000ae70ebb1 Partial-Bug: #1647813
Diffstat (limited to 'devstack')
-rw-r--r--devstack/lib/ironic19
1 files changed, 18 insertions, 1 deletions
diff --git a/devstack/lib/ironic b/devstack/lib/ironic
index e6f9fda8f..09fff975e 100644
--- a/devstack/lib/ironic
+++ b/devstack/lib/ironic
@@ -171,6 +171,9 @@ IRONIC_VM_LOG_CONSOLE=$(trueorfalse True IRONIC_VM_LOG_CONSOLE)
IRONIC_VM_LOG_DIR=${IRONIC_VM_LOG_DIR:-$IRONIC_DATA_DIR/logs/}
IRONIC_VM_LOG_ROTATE=$(trueorfalse True IRONIC_VM_LOG_ROTATE)
+# Set resource_classes for nodes to use Nova's placement engine
+IRONIC_USE_RESOURCE_CLASSES=$(trueorfalse False IRONIC_USE_RESOURCE_CLASSES)
+
# Whether to build the ramdisk or download a prebuilt one.
IRONIC_BUILD_DEPLOY_RAMDISK=$(trueorfalse True IRONIC_BUILD_DEPLOY_RAMDISK)
@@ -1301,6 +1304,8 @@ function create_bridge_and_vms {
}
function wait_for_nova_resources {
+ # TODO(jroll) if IRONIC_USE_RESOURCE_CLASSES, use the placement engine instead
+
# After nodes have been enrolled, we need to wait for both ironic and
# nova's periodic tasks to populate the resource tracker with available
# nodes and resources. Wait up to 2 minutes for a given resource before
@@ -1492,7 +1497,8 @@ function enroll_nodes {
fi
local node_id
- node_id=$(ironic node-create $standalone_node_uuid\
+ node_id=$(ironic \
+ node-create $standalone_node_uuid \
--chassis_uuid $chassis_id \
--driver $IRONIC_DEPLOY_DRIVER \
--name $node_prefix-$total_nodes \
@@ -1526,6 +1532,15 @@ function enroll_nodes {
ironic node-set-maintenance $node_id false
fi
+ local resource_class
+ if [[ "$IRONIC_USE_RESOURCE_CLASSES" == "True" ]]; then
+ # TODO(jroll) consider making this configurable, for now just make it unique per hardware combo
+ # this will look like baremetal_1cpu_256mbram_10gbdisk
+ resource_class="baremetal_${ironic_node_cpu}cpu_${ironic_node_ram}mbram_${ironic_node_disk}gbdisk"
+ openstack --os-baremetal-api-version 1.21 baremetal node set \
+ --resource-class $resource_class $node_id
+ fi
+
total_nodes=$((total_nodes+1))
total_cpus=$((total_cpus+$ironic_node_cpu))
done < $ironic_hwinfo_file
@@ -1534,6 +1549,8 @@ function enroll_nodes {
if [ "$VIRT_DRIVER" == "ironic" ]; then
local adjusted_disk
adjusted_disk=$(($ironic_node_disk - $ironic_ephemeral_disk))
+ # TODO(jroll) use (yet to be defined) new-style flavor here,
+ # if IRONIC_USE_RESOURCE_CLASSES == True
openstack flavor create --ephemeral $ironic_ephemeral_disk --ram $ironic_node_ram --disk $adjusted_disk --vcpus $ironic_node_cpu baremetal
openstack flavor set baremetal --property "cpu_arch"="$ironic_node_arch"