From edfd9f23c412230aef3e5143811e186a7ab5112b Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Thu, 28 Jan 2016 17:12:29 -0800 Subject: [PATCH] Check for existence of /dev/kvm When the nova-compute service is run inside of a container, the "Add kvm device to the compute" task currently checks that "nova_virt_type" is set to kvm. Since that variable is undefined by default, instead check for the existence of /dev/kvm on the physical host. Change-Id: Ibf2ac7adc18675b53b2a5ce37f43af4cbb5336f5 --- playbooks/os-nova-install.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/playbooks/os-nova-install.yml b/playbooks/os-nova-install.yml index e1bcb0197c..ff44efbe46 100644 --- a/playbooks/os-nova-install.yml +++ b/playbooks/os-nova-install.yml @@ -76,6 +76,17 @@ tags: - nova-kvm - nova-kvm-container-devices + - name: Check if kvm device exists + stat: + path: /dev/kvm + delegate_to: "{{ physical_host }}" + register: kvm_device + when: + - "inventory_hostname in groups['nova_compute']" + - "not is_metal | bool" + tags: + - nova-kvm + - nova-kvm-container-devices - name: Add kvm device to the compute shell: | lxc-device -n {{ container_name }} add /dev/kvm /dev/kvm @@ -87,7 +98,7 @@ when: - "inventory_hostname in groups['nova_compute']" - "not is_metal | bool" - - "nova_virt_type == 'kvm'" + - kvm_device.stat.ischr is defined and kvm_device.stat.ischr tags: - nova-kvm - nova-kvm-container-devices