Merge "Register traits on nodes in devstack"
This commit is contained in:
commit
180bfaf08c
|
@ -203,6 +203,9 @@ IRONIC_VM_LOG_ROTATE=$(trueorfalse True IRONIC_VM_LOG_ROTATE)
|
|||
# Set resource_classes for nodes to use Nova's placement engine
|
||||
IRONIC_DEFAULT_RESOURCE_CLASS=${IRONIC_DEFAULT_RESOURCE_CLASS:-baremetal}
|
||||
|
||||
# Set traits for nodes. Traits should be separated by whitespace.
|
||||
IRONIC_DEFAULT_TRAITS=${IRONIC_DEFAULT_TRAITS-CUSTOM_GOLD}
|
||||
|
||||
# Whether to build the ramdisk or download a prebuilt one.
|
||||
IRONIC_BUILD_DEPLOY_RAMDISK=$(trueorfalse True IRONIC_BUILD_DEPLOY_RAMDISK)
|
||||
|
||||
|
@ -1646,6 +1649,17 @@ function wait_for_nova_resources {
|
|||
| jq ".inventories.CUSTOM_$resource_class as \$cls
|
||||
| (\$cls.total // 0) - (\$cls.reserved // 0)")
|
||||
|
||||
# Check whether the resource provider has all expected traits
|
||||
# registered against it.
|
||||
rp_traits=$(curl -sH "X-Auth-Token: $token" \
|
||||
-H "OpenStack-API-Version: placement 1.6" \
|
||||
$endpoint/resource_providers/$p/traits)
|
||||
for trait in $IRONIC_DEFAULT_TRAITS; do
|
||||
if [[ $(echo "$rp_traits" | jq ".traits | contains([\"$trait\"])") == false ]]; then
|
||||
amount=0
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $amount -gt 0 ]; then
|
||||
count=$(( count + $amount ))
|
||||
fi
|
||||
|
@ -1931,6 +1945,10 @@ function enroll_nodes {
|
|||
die_if_not_set $LINENO node_id "Failed to create node"
|
||||
node_uuids+=" $node_id"
|
||||
|
||||
if [[ -n $IRONIC_DEFAULT_TRAITS ]]; then
|
||||
$IRONIC_CMD node add trait $node_id $IRONIC_DEFAULT_TRAITS
|
||||
fi
|
||||
|
||||
$IRONIC_CMD node manage $node_id --wait $IRONIC_MANAGE_TIMEOUT || \
|
||||
die $LINENO "Node did not reach manageable state in $IRONIC_MANAGE_TIMEOUT seconds"
|
||||
|
||||
|
@ -2011,6 +2029,10 @@ function enroll_nodes {
|
|||
openstack flavor set baremetal --property "capabilities:boot_mode"="uefi"
|
||||
fi
|
||||
|
||||
for trait in $IRONIC_DEFAULT_TRAITS; do
|
||||
openstack flavor set baremetal --property "trait:$trait"="required"
|
||||
done
|
||||
|
||||
# NOTE(dtantsur): sometimes nova compute fails to start with ironic due
|
||||
# to keystone restarting and not being able to authenticate us.
|
||||
# Restart it just to be sure (and avoid gate problems like bug 1537076)
|
||||
|
|
|
@ -135,6 +135,9 @@
|
|||
cat << 'EOF' >> ironic-extra-vars
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_SPECS_RAM=384"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_RAMDISK_TYPE=tinyipa"
|
||||
# TODO(mgoddard): Remove this when the queens ironic devstack
|
||||
# plugin has support for registering traits.
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_DEFAULT_TRAITS=\"\""
|
||||
|
||||
EOF
|
||||
chdir: '{{ ansible_user_dir }}/workspace'
|
||||
|
|
|
@ -78,6 +78,9 @@
|
|||
cat << 'EOF' >> ironic-extra-vars
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_SPECS_RAM=384"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_RAMDISK_TYPE=tinyipa"
|
||||
# TODO(mgoddard): Remove this when the queens ironic devstack
|
||||
# plugin has support for registering traits.
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_DEFAULT_TRAITS=\"\""
|
||||
|
||||
EOF
|
||||
chdir: '{{ ansible_user_dir }}/workspace'
|
||||
|
|
Loading…
Reference in New Issue