[devstack] use resource classes by default

Scheduling based on properties is disabled completely.
Properties are still populated for nodes, we need to figure out
an appropriate wait loop without them first.

Depends-On: I2fd1e4a95f000da19864e75299afa51527697101
Change-Id: I58601cb8301e23560ea666d4ea088ce51af37ee6
This commit is contained in:
Dmitry Tantsur 2017-06-23 18:08:15 +02:00 committed by Vladyslav Drok
parent 6f69fe7631
commit d5d8bd2703

View File

@ -183,7 +183,7 @@ 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)
IRONIC_USE_RESOURCE_CLASSES=$(trueorfalse True IRONIC_USE_RESOURCE_CLASSES)
IRONIC_DEFAULT_RESOURCE_CLASS=${IRONIC_DEFAULT_RESOURCE_CLASS:-baremetal}
# Whether to build the ramdisk or download a prebuilt one.
@ -1819,9 +1819,6 @@ function enroll_nodes {
--driver $IRONIC_DEPLOY_DRIVER \
--name $node_name \
--resource-class $IRONIC_DEFAULT_RESOURCE_CLASS \
--property cpus=$ironic_node_cpu\
--property memory_mb=$ironic_node_ram\
--property local_gb=$ironic_node_disk\
--property cpu_arch=$ironic_node_arch \
$node_capabilities \
$node_options \
@ -1832,6 +1829,11 @@ function enroll_nodes {
$IRONIC_CMD node manage $node_id --wait $IRONIC_MANAGE_TIMEOUT || \
die $LINENO "Node did not reach manageable state in $IRONIC_MANAGE_TIMEOUT seconds"
# TODO(dtantsur): only do it if IRONIC_USE_RESOURCE_CLASSES is False
$IRONIC_CMD node set $node_id --property cpus=$ironic_node_cpu \
--property memory_mb=$ironic_node_ram \
--property local_gb=$ironic_node_disk
# NOTE(vsaienko) IPA didn't automatically recognize root devices less than 4Gb.
# Setting root hint allows to install OS on such devices.
# 0x1af4 is VirtIO vendor device ID.
@ -1885,9 +1887,15 @@ function enroll_nodes {
if [[ "$HOST_TOPOLOGY_ROLE" != 'subnode' ]]; 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
if [[ "$IRONIC_USE_RESOURCE_CLASSES" == "True" ]]; then
local resource_class=${IRONIC_DEFAULT_RESOURCE_CLASS^^}
openstack flavor set baremetal --property "resources:CUSTOM_$resource_class"="1"
openstack flavor set baremetal --property "resources:DISK_GB"="0"
openstack flavor set baremetal --property "resources:MEMORY_MB"="0"
openstack flavor set baremetal --property "resources:VCPU"="0"
fi
openstack flavor set baremetal --property "cpu_arch"="$ironic_node_arch"
if [[ "$IRONIC_BOOT_MODE" == "uefi" ]]; then
@ -1909,6 +1917,7 @@ function enroll_nodes {
total_cpus=$(( total_cpus * 2 ))
fi
wait_for_nova_resources "count" $total_nodes
# TODO(dtantsur): only do it when IRONIC_USE_RESOURCE_CLASSES is False
wait_for_nova_resources "vcpus" $total_cpus
fi
}