Using custom fact to determine if we're in a VM

the facter is_virtual fact doesn't seem to work in all cases
returning false in some VM's

Change-Id: I34919d8c5c74a1c9458d976187335f9e7c2b2fdf
This commit is contained in:
Derek Higgins
2013-01-17 20:37:54 -05:00
parent 5edaa385ab
commit 22ebf630d1
2 changed files with 11 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
# is_virtual doesn't seem to work on all kvm vm's
# this custom one seem to do better
Facter.add("is_virtual_packstack") do
setcode do
Facter::Util::Resolution.exec('grep hypervisor /proc/cpuinfo > /dev/null && echo true || echo false')
end
end

View File

@@ -1,6 +1,6 @@
if $::is_virtual == "true" {
if $::is_virtual_packstack == "true" {
$libvirt_type = "qemu"
nova_config{
"libvirt_cpu_mode": value => "none";
@@ -28,7 +28,7 @@ class { 'nova::compute::libvirt':
vncserver_listen => "%(CONFIG_NOVA_COMPUTE_HOST)s",
}
if $::is_virtual == "true" and $::operatingsystem == "RedHat" {
if $::is_virtual_packstack == "true" and $::operatingsystem == "RedHat" {
file { "/usr/bin/qemu-system-x86_64":
ensure => link,
target => "/usr/libexec/qemu-kvm",