
nova::compute::libvirt was a class that deployed both libvirt (+ external services related to it) and nova-compute bits (mainly configuration). In the micro-services use-case, we want individual services, that can run alone in containers. To allow it, we need to split the nova compute configuration when libvirt is configured and the libvirt deployment. This patch aims to create nova::compute::libvirt::services that contain the bits from nova::compute::libvirt that used to deploy Libvirt and some other packages / services related to it. We keep backward compatibility by declaring the new class in nova::compute::libvirt but allow to disable it and select what we actually need thanks to parameters (we support hiera & non-hiera, see code for comments that document it). This is a first iteration of micro services for Compute nodes, soon we'll also work on nova::migration class to separate nova-compute & libvirt bits again. Change-Id: Ib0d3111560af5af451e522c6dc3b3918d0463e7d
106 lines
3.0 KiB
Puppet
106 lines
3.0 KiB
Puppet
# == Class: nova::compute::libvirt::services
|
|
#
|
|
# Install and manage libvirt services.
|
|
#
|
|
# === Parameters:
|
|
#
|
|
# [*libvirt_service_name*]
|
|
# (optional) libvirt service name.
|
|
# Defaults to $::nova::params::libvirt_service_name
|
|
#
|
|
# [*virtlock_service_name*]
|
|
# (optional) virtlock service name.
|
|
# Defaults to $::nova::params::virtlock_service_name
|
|
#
|
|
# [*virtlog_service_name*]
|
|
# (optional) virtlog service name.
|
|
# Defaults to $::nova::params::virtlog_service_name
|
|
#
|
|
# [*libvirt_virt_type*]
|
|
# (optional) Libvirt domain type. Options are: kvm, lxc, qemu, uml, xen
|
|
# Defaults to 'kvm'
|
|
#
|
|
class nova::compute::libvirt::services (
|
|
$libvirt_service_name = $::nova::params::libvirt_service_name,
|
|
$virtlock_service_name = $::nova::params::virtlock_service_name,
|
|
$virtlog_service_name = $::nova::params::virtlog_service_name,
|
|
$libvirt_virt_type = 'kvm',
|
|
) inherits nova::params {
|
|
|
|
include ::nova::deps
|
|
include ::nova::params
|
|
|
|
if $libvirt_service_name {
|
|
# messagebus
|
|
if($::osfamily == 'RedHat' and $::operatingsystem != 'Fedora') {
|
|
service { 'messagebus':
|
|
ensure => running,
|
|
enable => true,
|
|
name => $::nova::params::messagebus_service_name,
|
|
provider => $::nova::params::special_service_provider,
|
|
|
|
}
|
|
Package['libvirt'] -> Service['messagebus'] -> Service['libvirt']
|
|
}
|
|
|
|
# libvirt-nwfilter
|
|
if $::osfamily == 'RedHat' {
|
|
package { 'libvirt-nwfilter':
|
|
ensure => present,
|
|
name => $::nova::params::libvirt_nwfilter_package_name,
|
|
before => Service['libvirt'],
|
|
tag => ['openstack', 'nova-support-package'],
|
|
}
|
|
case $libvirt_virt_type {
|
|
'qemu': {
|
|
$libvirt_package_name_real = "${::nova::params::libvirt_daemon_package_prefix}kvm"
|
|
}
|
|
default: {
|
|
$libvirt_package_name_real = "${::nova::params::libvirt_daemon_package_prefix}${libvirt_virt_type}"
|
|
}
|
|
}
|
|
} else {
|
|
$libvirt_package_name_real = $::nova::params::libvirt_package_name
|
|
}
|
|
|
|
# libvirt
|
|
package { 'libvirt':
|
|
ensure => present,
|
|
name => $libvirt_package_name_real,
|
|
tag => ['openstack', 'nova-support-package'],
|
|
}
|
|
service { 'libvirt' :
|
|
ensure => running,
|
|
enable => true,
|
|
name => $libvirt_service_name,
|
|
provider => $::nova::params::special_service_provider,
|
|
require => Package['libvirt'],
|
|
}
|
|
|
|
# when nova-compute & libvirt run together
|
|
Service['libvirt'] -> Service<| title == 'nova-compute'|>
|
|
}
|
|
|
|
|
|
if $virtlock_service_name {
|
|
service { 'virtlockd':
|
|
ensure => running,
|
|
enable => true,
|
|
name => $virtlock_service_name,
|
|
provider => $::nova::params::special_service_provider,
|
|
require => Package['libvirt']
|
|
}
|
|
}
|
|
|
|
if $virtlog_service_name {
|
|
service { 'virtlogd':
|
|
ensure => running,
|
|
enable => true,
|
|
name => $virtlog_service_name,
|
|
provider => $::nova::params::special_service_provider,
|
|
require => Package['libvirt']
|
|
}
|
|
}
|
|
|
|
}
|