Fix nova_virt_type auto-detection

In https://review.openstack.org/243098 nova_virt_type auto-detection
was implemented, but the default nova_virt_type value of kvm was left
in place, resulting in the auto-detection never happening.

This patch implements the auto-detection if nova-virt_type is not set
and removes the default value for nova-virt_type.

Change-Id: Ic1c8f042bc6bbee542373d335f338866efa06dc7
This commit is contained in:
Jesse Pretorius 2015-12-02 14:40:47 +00:00
parent 84adf9dbf1
commit 79192de310
5 changed files with 37 additions and 27 deletions

View File

@ -60,15 +60,10 @@ nova_rpc_thread_pool_size: 64
nova_rpc_conn_pool_size: 30
nova_rpc_response_timeout: 60
## Nova virtualization Type Autodetect
# Set to True if nova_virt_type is not defined, then it will auto
# choose kvm or qemu for nova_virt_type according to /proc/cpuinfo
nova_virt_autodetect: True
## Nova virtualization Type, set to KVM if supported
# Current supported choice: qemu or kvm
# Once nova_virt_type is defined, then nova_virt_autodetect won't work any more
nova_virt_type: kvm
# If this is not set, then the playbook will try to guess it.
#nova_virt_type: kvm
## Nova Auth
nova_service_region: RegionOne

View File

@ -13,6 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- include: nova_virt_detect.yml
when: nova_virt_type is not defined
tags:
nova-virt-detect
- include: nova_pre_install.yml
- include: nova_install.yml
- include: nova_console_install.yml

View File

@ -14,7 +14,7 @@
# limitations under the License.
- include: nova_compute_kvm.yml
when: nova_virt_type == 'kvm' or nova_virt_type == 'qemu' or nova_virt_autodetect | bool
when: nova_virt_type == 'kvm' or nova_virt_type == 'qemu'
- include: nova_compute_key_populate.yml

View File

@ -13,25 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Get virt type value and store as var
shell: |
/usr/bin/egrep -c '(vmx|svm)' /proc/cpuinfo
register: virt_type_value
changed_when: false
failed_when: false
when: nova_virt_type != 'kvm' and nova_virt_type != 'qemu' and nova_virt_autodetect | bool
tags:
- nova-config
- nova-post-install
- name: Register a fact for the nova virt type
set_fact:
nova_virt_type: "{{ ((virt_type_value.stdout | int) > 0) | ternary('kvm', 'qemu') }}"
when: nova_virt_type != 'kvm' and nova_virt_type != 'qemu' and nova_virt_autodetect | bool
tags:
- nova-config
- nova-post-install
- name: Copy nova config
config_template:
src: "{{ item.src }}"

View File

@ -0,0 +1,29 @@
---
# Copyright 2014, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Get virt type value and store as var
shell: |
/usr/bin/egrep -c '(vmx|svm)' /proc/cpuinfo
register: virt_type_value
changed_when: false
failed_when: false
tags:
- nova-cpuinfo-read
- name: Register a fact for the nova virt type
set_fact:
nova_virt_type: "{{ ((virt_type_value.stdout | int) > 0) | ternary('kvm', 'qemu') }}"
tags:
- nova-virt-type-set