From b1df966e0234c4e3d8978ff949d2ebea523e5ea9 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Fri, 13 Sep 2019 12:27:48 -0500 Subject: [PATCH] Allow computes without virtualization enabled to be unlocked The goenabled script in mtce-compute checks if hardware virtualization is enabled, before allowing the node to become enabled. (hardware only) This check is only needed if the compute is being used as an openstack compute node, and so the check has been updated to look for the appropriate label. Puppet stores the labels in the hieradata file in /tmp. That file is recreated when the host is rebooted or unlocked, and labels cannot be changed unless a host is locked. Change-Id: I6862a1b7824c759f0c3caea37c3ae6e4e9ab43b7 Closes-Bug: 1843616 Signed-off-by: Al Bailey --- .../src/scripts/virt-support-goenabled.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mtce-compute/src/scripts/virt-support-goenabled.sh b/mtce-compute/src/scripts/virt-support-goenabled.sh index 753914d3..31c8fd52 100755 --- a/mtce-compute/src/scripts/virt-support-goenabled.sh +++ b/mtce-compute/src/scripts/virt-support-goenabled.sh @@ -35,6 +35,8 @@ OPTS+="nested_virt:${nested_virt}, " hardware_virt_supported=$(virt-host-validate qemu 2>/dev/null | grep -q -w -e FAIL && echo "false" || echo "true") OPTS+="hardware_virt_supported:${hardware_virt_supported}" REASONS=$(virt-host-validate qemu 2>/dev/null | grep -w -e FAIL) +openstack_label=$(grep -w -q openstack-compute-node /tmp/puppet/hieradata/host.yaml && echo "true" || echo "false") + # Check that virtualization is supported on hardware. It is sufficient just to # check the output of virt-host-validate. Additional facts are gathered for @@ -47,11 +49,15 @@ REASONS=$(virt-host-validate qemu 2>/dev/null | grep -w -e FAIL) # - on emulated systems such as VirtualBox or QEMU, vmx is not required # - if vmx is enabled on QEMU, it can also support nested virtualization -if [ "${host_type}" == "physical" ] && [ "${hardware_virt_supported}" == "false" ]; then - LOG "Virtualization is not supported: ${OPTS}. Failing goenabled check." - LOG "Failure reasons:"$'\n'"${REASONS}" - exit 1 +# Virtualization check is only required if openstack-compute-node label is detected. +if [ "${openstack_label}" == "true" ]; then + LOG "Openstack Label detected" + if [ "${host_type}" == "physical" ] && [ "${hardware_virt_supported}" == "false" ]; then + LOG "Virtualization is not supported: ${OPTS}. Failing goenabled check." + LOG "Failure reasons:"$'\n'"${REASONS}" + exit 1 + fi + LOG "Virtualization is supported: ${OPTS}." fi -LOG "Virtualization is supported: ${OPTS}." exit 0