From 1fa2eddee53d3ae2d2740437cabbd564469d6918 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Wed, 19 Dec 2012 16:57:06 -0500 Subject: [PATCH] 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 --- README | 3 --- packstack/plugins/nova_300.py | 20 -------------------- packstack/puppet/templates/nova_compute.pp | 14 ++++++++++++-- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/README b/README index 598008ec1..62827bd3a 100644 --- a/README +++ b/README @@ -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 : diff --git a/packstack/plugins/nova_300.py b/packstack/plugins/nova_300.py index 058704b6d..dfb94fd88 100644 --- a/packstack/plugins/nova_300.py +++ b/packstack/plugins/nova_300.py @@ -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()] diff --git a/packstack/puppet/templates/nova_compute.pp b/packstack/puppet/templates/nova_compute.pp index 54da9bc9b..8643e15d4 100644 --- a/packstack/puppet/templates/nova_compute.pp +++ b/packstack/puppet/templates/nova_compute.pp @@ -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",