Get the host_uuid for libvirt from hiera

* Fetch host_uuid from hiera
* Preserve the default value as is to
keep this change backwards compatible.
* Fix the uuid idempotency issue for Noop tests:
add host_uuid to the Noop astute.yaml templates for
compute as if it was put there from the Nailgun
backend.

Closes-bug: #1517915

Change-Id: I7437e56a7666abd32564acb715eb17c220a4896e
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2015-11-30 10:50:54 +01:00
parent b9f8c28f0e
commit 55cc0d2d2d
11 changed files with 32 additions and 10 deletions

View File

@ -78,6 +78,8 @@ class openstack::compute (
$glance_api_servers = undef,
# Virtualization
$libvirt_type = 'kvm',
# FIXME(bogdando) remove after fixed upstream https://review.openstack.org/131710
$host_uuid = undef,
# VNC
$vnc_enabled = true,
$vncproxy_host = undef,
@ -229,8 +231,6 @@ class openstack::compute (
notify => Service['libvirt'],
}
$host_uuid=generate('/bin/sh', '-c', "uuidgen")
augeas { 'libvirt-conf-uuid':
context => '/files/etc/libvirt/libvirtd.conf',
changes => [

View File

@ -15,6 +15,7 @@ describe 'openstack::compute' do
:rabbit_ha_queues => false,
:glance_api_servers => 'undef',
:libvirt_type => 'kvm',
:host_uuid => nil,
:vnc_enabled => true,
:vncproxy_host => false,
:vncserver_listen => '0.0.0.0',
@ -142,6 +143,10 @@ describe 'openstack::compute' do
:compute_driver => p[:compute_driver],
:libvirt_service_name => 'libvirtd'
)
should contain_augeas('libvirt-conf-uuid').with(
:context => '/files/etc/libvirt/libvirtd.conf',
:changes => "set host_uuid #{p[:host_uuid]}"
).that_notifies('Service[libvirt]')
if facts[:osfamily] == 'RedHat'
should contain_file_line('no_qemu_selinux')
elsif facts[:osfamily] == 'Debian'

View File

@ -233,6 +233,8 @@ class { 'openstack::compute':
private_interface => $use_neutron ? { true=>false, default=>hiera('private_int', undef)},
internal_address => get_network_role_property('nova/api', 'ipaddr'),
libvirt_type => hiera('libvirt_type', undef),
# FIXME(bogdando) remove after fixed upstream https://review.openstack.org/131710
host_uuid => hiera('host_uuid', generate('/bin/sh', '-c', 'uuidgen')),
fixed_range => $use_neutron ? { true=>false, default=>hiera('fixed_network_range', undef)},
network_manager => hiera('network_manager', undef),
network_config => hiera('network_config', {}),

View File

@ -119,6 +119,7 @@ syslog:
weight: 50
label: Syslog
libvirt_type: qemu
host_uuid: '00000000-0000-0000-0000-000000000000'
puppet:
modules: rsync://10.122.10.2:/puppet/2015.1.0-8.0/modules/
manifests: rsync://10.122.10.2:/puppet/2015.1.0-8.0/manifests/

View File

@ -119,6 +119,7 @@ syslog:
weight: 50
label: Syslog
libvirt_type: qemu
host_uuid: '00000000-0000-0000-0000-000000000000'
puppet:
modules: rsync://10.122.5.2:/puppet/2015.1.0-8.0/modules/
manifests: rsync://10.122.5.2:/puppet/2015.1.0-8.0/manifests/

View File

@ -119,6 +119,7 @@ syslog:
weight: 50
label: Syslog
libvirt_type: qemu
host_uuid: '00000000-0000-0000-0000-000000000000'
puppet:
modules: rsync://10.122.5.2:/puppet/2015.1.0-8.0/modules/
manifests: rsync://10.122.5.2:/puppet/2015.1.0-8.0/manifests/

View File

@ -91,6 +91,7 @@ keystone:
db_password: e4Op1FQB
last_controller: node-125
libvirt_type: qemu
host_uuid: '00000000-0000-0000-0000-000000000000'
management_network_range: 192.168.0.0/24
management_vip: 192.168.0.6
management_vrouter_vip: 192.168.0.7

View File

@ -91,6 +91,7 @@ keystone:
db_password: 32TWl29R
last_controller: node-131
libvirt_type: qemu
host_uuid: '00000000-0000-0000-0000-000000000000'
management_network_range: 192.168.0.0/24
management_vip: 192.168.0.6
management_vrouter_vip: 192.168.0.7

View File

@ -97,6 +97,7 @@ keystone:
db_password: MnrQiwLn
last_controller: node-137
libvirt_type: qemu
host_uuid: '00000000-0000-0000-0000-000000000000'
management_network_range: 192.168.0.0/24
management_vip: 192.168.0.5
management_vrouter_vip: 192.168.0.6

View File

@ -5,6 +5,8 @@ manifest = 'roles/compute.pp'
describe manifest do
shared_examples 'catalog' do
host_uuid = Noop.hiera 'host_uuid'
# Libvirtd.conf
it 'should configure listen_tls, listen_tcp and auth_tcp in libvirtd.conf' do
should contain_augeas('libvirt-conf').with(
@ -17,6 +19,13 @@ describe manifest do
)
end
it 'should configure libvirt host_uuid' do
should contain_augeas('libvirt-conf-uuid').with(
:context => '/files/etc/libvirt/libvirtd.conf',
:changes => "set host_uuid #{host_uuid}"
).that_notifies('Service[libvirt]')
end
# libvirt/qemu with(out) selinux/apparmor
it 'libvirt/qemu config should have proper security_driver and apparmor configuration' do
if facts[:osfamily] == 'RedHat'