prevent -l, libvirt on machines w/o capabilities

People may be tempted to run w/ -l on a vm.
Prevent libvirt workflow on noncapable machines.

Change-Id: I0723140ff3df5a2aaaf9be79f81deb85b9114b0d
This commit is contained in:
Wes Hayutin 2019-03-01 14:42:49 -07:00
parent e940b9f769
commit ae2c0afeee
1 changed files with 10 additions and 0 deletions

View File

@ -169,6 +169,16 @@ done
set -x
if [[ "$LIBVIRT" == "1" ]]; then
echo "check if virt flags are enabled on the cpu"
grep -q 'vmx\|smx' /proc/cpuinfo || LIBVIRT_ERROR=true
# grep hypervisor returns true on virt
echo "check if linux is running in a hypervisor"
grep -q 'hypervisor' /proc/cpuinfo && LIBVIRT_ERROR=true || true
if [[ ! -z "$LIBVIRT_ERROR" ]]; then
echo -e "\e[31m ERROR: -l, libvirt attempted on a machine w/o libvirt capabilities, or on a virtual instance \e[0m"
fi
curl -o bindep.txt https://raw.githubusercontent.com/rdo-infra/ansible-role-tripleo-ci-reproducer/master/bindep.txt
# Install rpms and other requirements