Now using the is_virtual facter fact to decide on libvirt type

This was a config value, but using facter the appropiate value can be
set on the nova compute host
https://bugzilla.redhat.com/show_bug.cgi?id=888756
This commit is contained in:
Derek Higgins 2012-12-19 16:57:06 -05:00
parent 38a64e4c40
commit 1fa2eddee5
3 changed files with 12 additions and 25 deletions

3
README
View File

@ -19,7 +19,6 @@ $ ./bin/packstack --gen-answer-file=ans.txt
o set CONFIG_SSH_KEY to a public ssh key to be installed to remote machines
o Edit 127.0.0.1 to anywhere you want to install a piece of openstack on another server
o Edit the 3 network interfaces to whatever makes sense in your setup
o If your testing on a vm then set CONFIG_LIBVIRT_TYPE=qemu
$ ./bin/packstack --answer-file=ans.txt
@ -34,8 +33,6 @@ $ swift list # if you have installed swift
Config options
CONFIG_LIBVIRT_TYPE :
set to kvm if on baremetal or qemu if testing on a vm
CONFIG_NOVA_COMPUTE_HOSTS :
a comma seperated list of ip addresses on which to install nova compute
CONFIG_SWIFT_STORAGE_HOSTS :

View File

@ -80,18 +80,6 @@ def initConfig(controllerObject):
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "libvirt-type",
"USAGE" : "The libvirt type to use, if your compute server is bare metal set to kvm, if testing on a vm set to qemu",
"PROMPT" : "The libvirt type to use, if your compute server is bare metal set to kvm, if testing on a vm set to qemu",
"OPTION_LIST" : ["qemu", "kvm"],
"VALIDATION_FUNC" : validate.validateOptions,
"DEFAULT_VALUE" : __get_libvirt_type_default(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_LIBVIRT_TYPE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novacompute-privif",
"USAGE" : "Private interface for Flat DHCP on the Nova compute servers",
"PROMPT" : "Private interface for Flat DHCP on the Nova compute servers",
@ -235,11 +223,6 @@ def createcomputemanifest():
nova_config_options.addOption("flat_interface", controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF'])
validate.r_validateIF(server, controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF'])
# if on a vm we need to set libvirt_cpu_mode to "none"
# see https://bugzilla.redhat.com/show_bug.cgi?id=858311
if controller.CONF["CONFIG_LIBVIRT_TYPE"] == "qemu":
nova_config_options.addOption("libvirt_cpu_mode", "none")
server.execute()
appendManifestFile(manifestfile, manifestdata + "\n" + nova_config_options.getManifestEntry())
@ -271,6 +254,3 @@ def createcommonmanifest():
data = getManifestTemplate("nova_common.pp")
appendManifestFile(os.path.split(manifestfile)[1], data)
def __get_libvirt_type_default():
with open('/proc/cpuinfo','r') as f:
return ('kvm', 'qemu')['hypervisor' in f.read()]

View File

@ -1,4 +1,14 @@
if $::is_virtual == "true" {
$libvirt_type = "qemu"
nova_config{
"libvirt_cpu_mode": value => "none";
}
}else{
$libvirt_type = "kvm"
}
nova_config{
"network_host": value => "%(CONFIG_NOVA_NETWORK_HOST)s";
"libvirt_inject_partition": value => "-1";
@ -11,11 +21,11 @@ class {"nova::compute":
}
class { 'nova::compute::libvirt':
libvirt_type => "%(CONFIG_LIBVIRT_TYPE)s",
libvirt_type => "$libvirt_type",
vncserver_listen => "%(CONFIG_NOVA_COMPUTE_HOST)s",
}
if "%(CONFIG_LIBVIRT_TYPE)s" == "qemu" and $::operatingsystem == "RedHat" {
if $::is_virtual == "true" and $::operatingsystem == "RedHat" {
file { "/usr/bin/qemu-system-x86_64":
ensure => link,
target => "/usr/libexec/qemu-kvm",