Merge "[devstack] use resource classes by default"

This commit is contained in:
Jenkins 2017-08-19 10:47:19 +00:00 committed by Gerrit Code Review
commit 82fc8bdad6

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.
@ -1760,9 +1760,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 \
@ -1773,6 +1770,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.
@ -1826,9 +1828,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
@ -1850,6 +1858,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
}