puppet-nova/manifests/compute/libvirt.pp

56 lines
1.4 KiB
Puppet

#
class nova::compute::libvirt (
$libvirt_type = 'kvm',
$vncserver_listen = '127.0.0.1',
$migration_support = false
) {
include nova::params
Service['libvirt'] -> Service['nova-compute']
if($::osfamily == 'Debian') {
package { "nova-compute-${libvirt_type}":
ensure => present,
before => Package['nova-compute'],
}
}
if($::osfamily == 'RedHat' and $::operatingsystem != 'Fedora') {
service { 'messagebus':
ensure => running,
enable => true,
provider => $::nova::params::special_service_provider,
}
Package['libvirt'] -> Service['messagebus'] -> Service['libvirt']
}
if $migration_support {
if $vncserver_listen != '0.0.0.0' {
fail("For migration support to work, you MUST set vncserver_listen to '0.0.0.0'")
} else {
class { 'nova::migration::libvirt': }
}
}
package { 'libvirt':
ensure => present,
name => $::nova::params::libvirt_package_name,
}
service { 'libvirt' :
ensure => running,
name => $::nova::params::libvirt_service_name,
provider => $::nova::params::special_service_provider,
require => Package['libvirt'],
}
nova_config {
'DEFAULT/compute_driver': value => 'libvirt.LibvirtDriver';
'DEFAULT/libvirt_type': value => $libvirt_type;
'DEFAULT/connection_type': value => 'libvirt';
'DEFAULT/vncserver_listen': value => $vncserver_listen;
}
}