From 2a5ff43fb87965d8be03e93665ae28831fe1f7e2 Mon Sep 17 00:00:00 2001 From: jkilpatr Date: Tue, 19 Jul 2016 16:40:19 -0400 Subject: [PATCH] Added metadata flag for nested virtualization As requested in this Trello card, this commit adds a nested virtualization flag to the compute metadata by checking /proc/cpuinfo for the hypervisor flag. https://trello.com/c/24QvbT8m/127-check-site-add-a-check-for-kvm-intel-have-nested-1 Change-Id: I7a7dc30ae9bccf7dca2f296f83661899cbe9a96b --- ansible/gather/roles/compute/tasks/main.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ansible/gather/roles/compute/tasks/main.yml b/ansible/gather/roles/compute/tasks/main.yml index 39f96ab0c..d2411c361 100644 --- a/ansible/gather/roles/compute/tasks/main.yml +++ b/ansible/gather/roles/compute/tasks/main.yml @@ -24,3 +24,19 @@ set_fact: openstack_neutron_ovsdb: "vsctl" when: (ovsdb_status.stdout.find('native') == -1 and ovsdb_status.stdout.find('vsctl') == -1) + + +- name: Check for Nested Virtualization + shell: cat /proc/cpuinfo | grep hypervisor + register: nested_virt + ignore_errors: true + +- name: Set Nested Virtualization flag + set_fact: + openstack_nested_virt: true + when: nested_virt.stdout != "" + +- name: Set Nested Virtualization flag + set_fact: + openstack_nested_virt: false + when: nested_virt.stdout == ""