From 22ebf630d17114701275bcc9c5ab6ddd96402f70 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Thu, 17 Jan 2013 20:37:54 -0500 Subject: [PATCH] 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 --- packstack/puppet/facts/is_virtual_packstack.rb | 9 +++++++++ packstack/puppet/templates/nova_compute.pp | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 packstack/puppet/facts/is_virtual_packstack.rb diff --git a/packstack/puppet/facts/is_virtual_packstack.rb b/packstack/puppet/facts/is_virtual_packstack.rb new file mode 100644 index 000000000..f792b3a66 --- /dev/null +++ b/packstack/puppet/facts/is_virtual_packstack.rb @@ -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 diff --git a/packstack/puppet/templates/nova_compute.pp b/packstack/puppet/templates/nova_compute.pp index 6bf28d1b0..7fe16ec4c 100644 --- a/packstack/puppet/templates/nova_compute.pp +++ b/packstack/puppet/templates/nova_compute.pp @@ -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",