Merge "Drop openstack::compute"
This commit is contained in:
commit
a836a98261
@ -1,431 +0,0 @@
|
||||
#
|
||||
# == Class: openstack::compute
|
||||
#
|
||||
# Manifest to install/configure nova-compute
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# See params.pp
|
||||
#
|
||||
# [internal_address] Internal address used for management. Required.
|
||||
# Defaults to false.
|
||||
# assign a floating IP address to virtual instances when they are launched.
|
||||
# Defaults to false.
|
||||
# Optional. Defaults to false.
|
||||
# network settings. Optioal. Defaults to {}
|
||||
# [sql_connection] SQL connection information. Optional. Defaults to false
|
||||
# which indicates that exported resources will be used to determine connection
|
||||
# information.
|
||||
# [amqp_hosts] RabbitMQ hosts or false. Optional. Defaults to false.
|
||||
# [amqp_user] RabbitMQ user. Optional. Defaults to 'nova',
|
||||
# [amqp_password] RabbitMQ password. Optional. Defaults to 'rabbit_pw',
|
||||
# [glance_api_servers] List of glance api servers of the form HOST:PORT
|
||||
# delimited by ':'. False indicates that the resource should be collected.
|
||||
# Optional. Defaults to false,
|
||||
# [libvirt_type] Underlying libvirt supported hypervisor.
|
||||
# Optional. Defaults to 'kvm',
|
||||
# [vncproxy_protocol] Protocol to use for access vnc proxy. Optional.
|
||||
# Defaults to 'http'.
|
||||
# [vncproxy_host] Host that serves as vnc proxy. Optional.
|
||||
# Defaults to false. False indicates that a vnc proxy should not be configured.
|
||||
# [verbose] Rather to print more verbose (INFO+) output. If non verbose and non debug. Optional. Defaults to false.
|
||||
# [debug] Rather to print even more verbose (DEBUG+) output. If true, would ignore verbose option. Optional. Defaults to false.
|
||||
# [use_syslog] Rather or not service should log to syslog. Optional.
|
||||
# [use_stderr] Rather or not service should log to stderr. Optional.
|
||||
# [syslog_log_facility] Facility for syslog, if used. Optional. Note: duplicating conf option
|
||||
# wouldn't have been used, but more powerfull rsyslog features managed via conf template instead
|
||||
# [ssh_private_key] path to private ssh key temporary location on this server where it was uploaded or generated
|
||||
# [ssh_public_key] path to public ssh key temporary location on this server where it was uploaded or generated
|
||||
# [compute_driver] Driver to use for controlling virtualization.
|
||||
#
|
||||
# class { 'openstack::nova::compute':
|
||||
# internal_address => '192.168.2.2',
|
||||
# vncproxy_host => '192.168.1.1',
|
||||
# }
|
||||
|
||||
class openstack::compute (
|
||||
# Required Network
|
||||
$internal_address,
|
||||
# Required Nova
|
||||
# RPC
|
||||
$rpc_backend = 'rabbit',
|
||||
$amqp_hosts = false,
|
||||
$amqp_user = 'nova',
|
||||
$amqp_password = 'rabbit_pw',
|
||||
$glance_api_servers = undef,
|
||||
$libvirt_type = 'kvm',
|
||||
# VNC
|
||||
$vncproxy_protocol = 'http',
|
||||
$vncproxy_host = undef,
|
||||
$vncserver_listen = '0.0.0.0',
|
||||
$migration_support = false,
|
||||
# General
|
||||
$enabled = true,
|
||||
# nova compute configuration parameters
|
||||
$nova_hash = {},
|
||||
$use_huge_pages = false,
|
||||
$vcpu_pin_set = undef,
|
||||
$verbose = false,
|
||||
$debug = false,
|
||||
$ssh_private_key = '/var/lib/astute/nova/nova',
|
||||
$ssh_public_key = '/var/lib/astute/nova/nova.pub',
|
||||
$cache_server_ip = ['127.0.0.1'],
|
||||
$cache_server_port = '11211',
|
||||
$pci_passthrough = undef,
|
||||
$use_syslog = false,
|
||||
$use_stderr = true,
|
||||
$syslog_log_facility = 'LOG_LOCAL6',
|
||||
$nova_report_interval = '10',
|
||||
$nova_service_down_time = '60',
|
||||
$state_path = '/var/lib/nova',
|
||||
$notification_driver = 'noop',
|
||||
$storage_hash = {},
|
||||
$compute_driver = 'libvirt.LibvirtDriver',
|
||||
$config_drive_format = undef,
|
||||
$network_device_mtu = '65000',
|
||||
) {
|
||||
|
||||
include ::nova::params
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
|
||||
# From legacy libvirt.pp
|
||||
exec { 'symlink-qemu-kvm':
|
||||
command => '/bin/ln -sf /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64',
|
||||
creates => '/usr/bin/qemu-system-x86_64',
|
||||
}
|
||||
|
||||
package { 'avahi':
|
||||
ensure => present;
|
||||
}
|
||||
|
||||
service { 'avahi-daemon':
|
||||
ensure => running,
|
||||
require => Package['avahi'];
|
||||
}
|
||||
|
||||
Package['avahi'] ->
|
||||
Service['messagebus'] ->
|
||||
Service['avahi-daemon'] ->
|
||||
Service['libvirt']
|
||||
|
||||
service { 'libvirt-guests':
|
||||
name => 'libvirt-guests',
|
||||
enable => false,
|
||||
ensure => true,
|
||||
hasstatus => false,
|
||||
hasrestart => false,
|
||||
}
|
||||
|
||||
# From legacy params.pp
|
||||
$libvirt_type_kvm = 'qemu-kvm'
|
||||
$guestmount_package_name = 'libguestfs-tools-c'
|
||||
|
||||
# From legacy utilities.pp
|
||||
package { ['unzip', 'curl', 'euca2ools']:
|
||||
ensure => present
|
||||
}
|
||||
if !(defined(Package['parted'])) {
|
||||
package {'parted': ensure => 'present' }
|
||||
}
|
||||
|
||||
package {$guestmount_package_name: ensure => present}
|
||||
}
|
||||
'Debian': {
|
||||
# From legacy params
|
||||
$libvirt_type_kvm = 'qemu-kvm'
|
||||
$guestmount_package_name = 'guestmount'
|
||||
}
|
||||
default: { fail("Unsupported osfamily: ${::osfamily}") }
|
||||
}
|
||||
|
||||
if $::osfamily == 'Debian' {
|
||||
if $use_huge_pages {
|
||||
$qemu_hugepages_value = 'set KVM_HUGEPAGES 1'
|
||||
$libvirt_hugetlbfs_mount = 'set hugetlbfs_mount /run/hugepages/kvm'
|
||||
} else {
|
||||
$qemu_hugepages_value = 'rm KVM_HUGEPAGES'
|
||||
$libvirt_hugetlbfs_mount = 'rm hugetlbfs_mount'
|
||||
}
|
||||
augeas { 'qemu_hugepages':
|
||||
context => '/files/etc/default/qemu-kvm',
|
||||
changes => $qemu_hugepages_value,
|
||||
notify => Service['libvirt'],
|
||||
}
|
||||
augeas { 'libvirt_hugetlbfs_mount':
|
||||
context => '/files/etc/libvirt/qemu.conf',
|
||||
changes => $libvirt_hugetlbfs_mount,
|
||||
notify => Service['libvirt'],
|
||||
}
|
||||
|
||||
Augeas['qemu_hugepages'] ~> Service<| title == 'qemu-kvm'|>
|
||||
Service<| title == 'qemu-kvm'|> -> Service<| title == 'libvirt'|>
|
||||
}
|
||||
|
||||
if ($::operatingsystem == 'Ubuntu') and ($libvirt_type =='kvm') {
|
||||
# TODO(skolekonov): Remove when LP#1057024 has been resolved.
|
||||
# https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/1057024
|
||||
file { '/dev/kvm':
|
||||
ensure => present,
|
||||
group => 'kvm',
|
||||
mode => '0660',
|
||||
}
|
||||
Service<| title == 'qemu-kvm'|> -> File['/dev/kvm']
|
||||
}
|
||||
|
||||
$memcached_addresses = suffix($cache_server_ip, inline_template(":<%= @cache_server_port %>"))
|
||||
$notify_on_state_change = 'vm_and_task_state'
|
||||
|
||||
if $debug {
|
||||
class { 'nova::logging':
|
||||
default_log_levels => {
|
||||
'oslo.messaging' => 'DEBUG',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class { 'nova':
|
||||
install_utilities => false,
|
||||
rpc_backend => $rpc_backend,
|
||||
#FIXME(bogdando) we have to split amqp_hosts until all modules synced
|
||||
rabbit_hosts => split($amqp_hosts, ','),
|
||||
rabbit_userid => $amqp_user,
|
||||
rabbit_password => $amqp_password,
|
||||
kombu_reconnect_delay => '5.0',
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => $glance_api_servers,
|
||||
verbose => $verbose,
|
||||
debug => $debug,
|
||||
use_syslog => $use_syslog,
|
||||
use_stderr => $use_stderr,
|
||||
log_facility => $syslog_log_facility,
|
||||
state_path => $state_path,
|
||||
report_interval => $nova_report_interval,
|
||||
service_down_time => $nova_service_down_time,
|
||||
notify_on_state_change => $notify_on_state_change,
|
||||
notification_driver => $notification_driver,
|
||||
memcached_servers => $memcached_addresses,
|
||||
cinder_catalog_info => pick($nova_hash['cinder_catalog_info'], 'volumev2:cinderv2:internalURL'),
|
||||
}
|
||||
|
||||
class {'::nova::availability_zone':
|
||||
default_availability_zone => $nova_hash['default_availability_zone'],
|
||||
default_schedule_zone => $nova_hash['default_schedule_zone'],
|
||||
}
|
||||
|
||||
if str2bool($::is_virtual) {
|
||||
$libvirt_cpu_mode = 'none'
|
||||
} else {
|
||||
$libvirt_cpu_mode = 'host-model'
|
||||
}
|
||||
# Install / configure nova-compute
|
||||
|
||||
# From legacy ceilometer notifications for nova
|
||||
$instance_usage_audit = true
|
||||
$instance_usage_audit_period = 'hour'
|
||||
|
||||
####### Disable upstart startup on install #######
|
||||
if($::operatingsystem == 'Ubuntu') {
|
||||
tweaks::ubuntu_service_override { 'nova-compute':
|
||||
package_name => "nova-compute-${libvirt_type}",
|
||||
}
|
||||
}
|
||||
|
||||
class { '::nova::compute':
|
||||
enabled => $enabled,
|
||||
vncserver_proxyclient_address => $internal_address,
|
||||
vncproxy_protocol => $vncproxy_protocol,
|
||||
vncproxy_host => $vncproxy_host,
|
||||
vncproxy_port => $nova_hash['vncproxy_port'],
|
||||
force_config_drive => $nova_hash['force_config_drive'],
|
||||
pci_passthrough => $pci_passthrough,
|
||||
network_device_mtu => $network_device_mtu,
|
||||
instance_usage_audit => $instance_usage_audit,
|
||||
instance_usage_audit_period => $instance_usage_audit_period,
|
||||
reserved_host_memory => $nova_hash['reserved_host_memory'],
|
||||
config_drive_format => $config_drive_format,
|
||||
allow_resize_to_same_host => true,
|
||||
vcpu_pin_set => $vcpu_pin_set,
|
||||
}
|
||||
|
||||
nova_config {
|
||||
'libvirt/live_migration_flag': value => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST';
|
||||
'libvirt/block_migration_flag': value => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_NON_SHARED_INC';
|
||||
'DEFAULT/connection_type': value => 'libvirt';
|
||||
}
|
||||
|
||||
if $use_syslog {
|
||||
nova_config {
|
||||
'DEFAULT/use_syslog_rfc_format': value => true;
|
||||
}
|
||||
}
|
||||
|
||||
# The default value for inject_partition is -2, so it will be disabled
|
||||
# when we use Ceph for ephemeral storage or for Cinder. We only need to
|
||||
# modify the libvirt_disk_cachemodes in that case.
|
||||
if ($storage_hash['ephemeral_ceph'] or $storage_hash['volumes_ceph']) {
|
||||
$disk_cachemodes = ['"network=writeback,block=none"']
|
||||
$libvirt_inject_partition = '-2'
|
||||
} else {
|
||||
if $::osfamily == 'RedHat' {
|
||||
$libvirt_inject_partition = '-1'
|
||||
} else {
|
||||
# Enable module by default on each compute node
|
||||
k_mod {'nbd':
|
||||
ensure => 'present'
|
||||
}
|
||||
file_line {'nbd_on_boot':
|
||||
path => '/etc/modules',
|
||||
line => 'nbd',
|
||||
}
|
||||
$libvirt_inject_partition = '1'
|
||||
}
|
||||
$disk_cachemodes = ['"file=directsync,block=none"']
|
||||
}
|
||||
|
||||
# Configure libvirt for nova-compute
|
||||
class { 'nova::compute::libvirt':
|
||||
libvirt_virt_type => $libvirt_type,
|
||||
libvirt_cpu_mode => $libvirt_cpu_mode,
|
||||
libvirt_disk_cachemodes => $disk_cachemodes,
|
||||
libvirt_inject_partition => $libvirt_inject_partition,
|
||||
vncserver_listen => $vncserver_listen,
|
||||
migration_support => $migration_support,
|
||||
remove_unused_original_minimum_age_seconds => pick($nova_hash['remove_unused_original_minimum_age_seconds'], '86400'),
|
||||
compute_driver => $compute_driver,
|
||||
libvirt_service_name => $::nova::params::libvirt_service_name,
|
||||
}
|
||||
|
||||
class { 'nova::migration::libvirt':
|
||||
override_uuid => true,
|
||||
}
|
||||
|
||||
# From legacy libvirt.pp
|
||||
if $::operatingsystem == 'Ubuntu' {
|
||||
package { 'cpufrequtils':
|
||||
ensure => present;
|
||||
}
|
||||
file { '/etc/default/cpufrequtils':
|
||||
content => "GOVERNOR=\"performance\"\n",
|
||||
require => Package['cpufrequtils'],
|
||||
notify => Service['cpufrequtils'],
|
||||
}
|
||||
service { 'cpufrequtils':
|
||||
ensure => 'running',
|
||||
enable => true,
|
||||
status => '/bin/true',
|
||||
}
|
||||
|
||||
Package<| title == 'cpufrequtils'|> ~> Service<| title == 'cpufrequtils'|>
|
||||
if !defined(Service['cpufrequtils']) {
|
||||
notify{ "Module ${module_name} cannot notify service cpufrequtils on package update": }
|
||||
}
|
||||
}
|
||||
|
||||
package { $libvirt_type_kvm:
|
||||
ensure => present,
|
||||
before => Package[$::nova::params::compute_package_name],
|
||||
}
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
if $libvirt_type =='kvm' {
|
||||
exec { '/etc/sysconfig/modules/kvm.modules':
|
||||
path => '/sbin:/usr/sbin:/bin:/usr/bin',
|
||||
unless => 'lsmod | grep -q kvm',
|
||||
require => Package[$libvirt_type_kvm],
|
||||
}
|
||||
}
|
||||
}
|
||||
'Debian': {
|
||||
service { 'qemu-kvm':
|
||||
ensure => running,
|
||||
require => Package[$libvirt_type_kvm],
|
||||
subscribe => Package[$libvirt_type_kvm],
|
||||
}
|
||||
}
|
||||
default: { fail("Unsupported osfamily: ${osfamily}") }
|
||||
}
|
||||
|
||||
Service<| title == 'libvirt'|> ~> Service<| title == 'nova-compute'|>
|
||||
Package<| title == "nova-compute-${libvirt_type}"|> ~>
|
||||
Service<| title == 'nova-compute'|>
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
file_line { 'qemu_selinux':
|
||||
path => '/etc/libvirt/qemu.conf',
|
||||
line => 'security_driver = "selinux"',
|
||||
require => Package[$::nova::params::libvirt_package_name],
|
||||
notify => Service['libvirt']
|
||||
}
|
||||
}
|
||||
'Debian': {
|
||||
file_line { 'qemu_apparmor':
|
||||
path => '/etc/libvirt/qemu.conf',
|
||||
line => 'security_driver = "apparmor"',
|
||||
require => Package[$::nova::params::libvirt_package_name],
|
||||
notify => Service['libvirt']
|
||||
}
|
||||
|
||||
file_line { 'apparmor_libvirtd':
|
||||
path => '/etc/apparmor.d/usr.sbin.libvirtd',
|
||||
line => "# unix, # shouldn't be used for libvirt/qemu",
|
||||
match => '^[#[:space:]]*unix',
|
||||
}
|
||||
|
||||
exec { 'refresh_apparmor':
|
||||
refreshonly => true,
|
||||
command => '/sbin/apparmor_parser -r /etc/apparmor.d/usr.sbin.libvirtd',
|
||||
subscribe => File_line['apparmor_libvirtd'],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Package<| title == 'nova-compute'|> ~> Service<| title == 'nova-compute'|>
|
||||
if !defined(Service['nova-compute']) {
|
||||
notify{ "Module ${module_name} cannot notify service nova-compute on packages update": }
|
||||
}
|
||||
|
||||
Package<| title == 'libvirt'|> ~> Service<| title == 'libvirt'|>
|
||||
if !defined(Service['libvirt']) {
|
||||
notify{ "Module ${module_name} cannot notify service libvirt on package update": }
|
||||
}
|
||||
|
||||
include nova::client
|
||||
|
||||
# Ensure ssh clients are installed
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
$scp_package='openssh-client'
|
||||
$multipath_tools_package='multipath-tools'
|
||||
}
|
||||
'RedHat': {
|
||||
$scp_package='openssh-clients'
|
||||
$multipath_tools_package='device-mapper-multipath'
|
||||
}
|
||||
default: { fail("Unsupported osfamily: ${osfamily}") }
|
||||
}
|
||||
|
||||
ensure_packages([$scp_package, $multipath_tools_package])
|
||||
|
||||
# Install ssh keys and config file
|
||||
install_ssh_keys {'nova_ssh_key_for_migration':
|
||||
ensure => present,
|
||||
user => 'nova',
|
||||
private_key_path => $ssh_private_key,
|
||||
public_key_path => $ssh_public_key,
|
||||
private_key_name => 'id_rsa',
|
||||
public_key_name => 'id_rsa.pub',
|
||||
authorized_keys => 'authorized_keys',
|
||||
} ->
|
||||
file { '/var/lib/nova/.ssh/config':
|
||||
ensure => present,
|
||||
owner => 'nova',
|
||||
group => 'nova',
|
||||
mode => '0600',
|
||||
content => "Host *\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null\n",
|
||||
}
|
||||
|
||||
}
|
@ -1,193 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'openstack::compute' do
|
||||
|
||||
before :each do
|
||||
Puppet::Parser::Functions.newfunction(:is_pkg_installed, :type => :rvalue) {
|
||||
|args| true
|
||||
}
|
||||
end
|
||||
|
||||
let(:default_params) { {
|
||||
:internal_address => nil,
|
||||
:rpc_backend => 'rabbit',
|
||||
:amqp_hosts => false,
|
||||
:amqp_user => 'nova',
|
||||
:amqp_password => 'rabbit_pw',
|
||||
:rabbit_ha_queues => false,
|
||||
:glance_api_servers => 'undef',
|
||||
:libvirt_type => 'kvm',
|
||||
:vncproxy_host => false,
|
||||
:vncserver_listen => '0.0.0.0',
|
||||
:migration_support => nil,
|
||||
:enabled => true,
|
||||
:nova_hash => {},
|
||||
:verbose => false,
|
||||
:debug => false,
|
||||
:ssh_private_key => '/var/lib/astute/nova/nova',
|
||||
:ssh_public_key => '/var/lib/astute/nova/nova.pub',
|
||||
:cache_server_ip => ['127.0.0.1'],
|
||||
:cache_server_port => '11211',
|
||||
:use_syslog => false,
|
||||
:use_stderr => true,
|
||||
:syslog_log_facility => 'LOG_LOCAL6',
|
||||
:nova_report_interval => '10',
|
||||
:nova_service_down_time => '60',
|
||||
:state_path => '/var/lib/nova',
|
||||
:storage_hash => {},
|
||||
:compute_driver => 'libvirt.LibvirtDriver',
|
||||
:config_drive_format => nil,
|
||||
} }
|
||||
|
||||
let(:params) { {} }
|
||||
|
||||
shared_examples_for 'compute configuration' do
|
||||
let :p do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
|
||||
context 'with a default config' do
|
||||
|
||||
let :params do
|
||||
{ :internal_address => '127.0.0.1',
|
||||
:amqp_hosts => '127.0.0.1:55555',
|
||||
:glance_api_servers => 'localhost:9292',
|
||||
}
|
||||
end
|
||||
|
||||
it 'contains openstack::compute' do
|
||||
should contain_class('openstack::compute')
|
||||
end
|
||||
|
||||
it 'configures with the default params' do
|
||||
if facts[:os_package_type] == 'debian' or facts[:osfamily] == 'RedHat'
|
||||
libvirt_service_name = 'libvirtd'
|
||||
else
|
||||
libvirt_service_name = 'libvirt-bin'
|
||||
end
|
||||
host_uuid = facts[:libvirt_uuid]
|
||||
should contain_class('nova').with(
|
||||
:install_utilities => false,
|
||||
:ensure_package => 'present',
|
||||
:rpc_backend => p[:rpc_backend],
|
||||
:rabbit_hosts => [ params[:amqp_hosts] ],
|
||||
:rabbit_userid => p[:amqp_user],
|
||||
:rabbit_password => p[:amqp_password],
|
||||
:kombu_reconnect_delay => '5.0',
|
||||
:image_service => 'nova.image.glance.GlanceImageService',
|
||||
:glance_api_servers => p[:glance_api_servers],
|
||||
:verbose => p[:verbose],
|
||||
:debug => p[:debug],
|
||||
:use_syslog => p[:use_syslog],
|
||||
:use_stderr => p[:use_stderr],
|
||||
:log_facility => p[:syslog_log_facility],
|
||||
:state_path => p[:state_path],
|
||||
:report_interval => p[:nova_report_interval],
|
||||
:service_down_time => p[:nova_service_down_time],
|
||||
:notify_on_state_change => 'vm_and_task_state',
|
||||
:memcached_servers => ['127.0.0.1:11211'],
|
||||
)
|
||||
if p[:debug]
|
||||
should contain_class('nova::logging').with(
|
||||
'default_log_levels' => {
|
||||
'oslo.messaging' => 'DEBUG',
|
||||
}
|
||||
)
|
||||
end
|
||||
should contain_class('nova::availability_zone').with(
|
||||
:default_availability_zone => '<SERVICE DEFAULT>',
|
||||
:default_schedule_zone => '<SERVICE DEFAULT>',
|
||||
)
|
||||
should contain_class('nova::compute').with(
|
||||
:ensure_package => 'present',
|
||||
:enabled => p[:enabled],
|
||||
:vncserver_proxyclient_address => p[:internal_address],
|
||||
:vncproxy_host => p[:vncproxy_host],
|
||||
:vncproxy_port => '6080',
|
||||
:force_config_drive => false,
|
||||
:neutron_enabled => true,
|
||||
:network_device_mtu => '65000',
|
||||
:instance_usage_audit => true,
|
||||
:instance_usage_audit_period => 'hour',
|
||||
:default_schedule_zone => nil,
|
||||
:config_drive_format => p[:config_drive_format]
|
||||
)
|
||||
should contain_class('nova::compute::libvirt').with(
|
||||
:libvirt_virt_type => p[:libvirt_type],
|
||||
:vncserver_listen => p[:vncserver_listen],
|
||||
:migration_suport => p[:migration_support],
|
||||
:remove_unused_original_minimum_age_seconds => '86400',
|
||||
:compute_driver => p[:compute_driver],
|
||||
:libvirt_service_name => libvirt_service_name,
|
||||
)
|
||||
should contain_augeas('libvirt-conf-uuid').with(
|
||||
:context => '/files/etc/libvirt/libvirtd.conf',
|
||||
:changes => ["set host_uuid #{host_uuid}"],
|
||||
).that_notifies('Service[libvirt]')
|
||||
if facts[:osfamily] == 'RedHat'
|
||||
should contain_file_line('qemu_selinux')
|
||||
should contain_package('device-mapper-multipath')
|
||||
elsif facts[:osfamily] == 'Debian'
|
||||
should contain_file_line('qemu_apparmor')
|
||||
should contain_file_line('apparmor_libvirtd')
|
||||
should contain_package('multipath-tools')
|
||||
end
|
||||
should contain_class('nova::client')
|
||||
should contain_install_ssh_keys('nova_ssh_key_for_migration')
|
||||
should contain_file('/var/lib/nova/.ssh/config')
|
||||
|
||||
if facts[:operatingsystem] == 'Ubuntu'
|
||||
should contain_package('cpufrequtils').with(
|
||||
:ensure => 'present'
|
||||
)
|
||||
should contain_file('/etc/default/cpufrequtils').with(
|
||||
:content => "GOVERNOR=\"performance\"\n",
|
||||
:require => 'Package[cpufrequtils]',
|
||||
:notify => 'Service[cpufrequtils]',
|
||||
)
|
||||
should contain_service('cpufrequtils').with(
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:status => '/bin/true',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:hostname => 'hostname.example.com',
|
||||
:openstack_version => { 'nova' => 'present' },
|
||||
:os_service_default => '<SERVICE DEFAULT>',
|
||||
:os_package_type => 'debian',
|
||||
:libvirt_uuid => '370d7c4c19b84f4ab34f213764e4663d',
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'compute configuration'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'CentOS',
|
||||
:hostname => 'hostname.example.com',
|
||||
:openstack_version => { 'nova' => 'present' },
|
||||
:os_service_default => '<SERVICE DEFAULT>',
|
||||
:os_package_type => 'rpm',
|
||||
:operatingsystemmajrelease => '7',
|
||||
:libvirt_uuid => '370d7c4c19b84f4ab34f213764e4663d',
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'compute configuration'
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -48,6 +48,7 @@ $public_ssl_hash = hiera_hash('public_ssl')
|
||||
$ssl_hash = hiera_hash('use_ssl', {})
|
||||
$node_hash = hiera_hash('node', {})
|
||||
$use_huge_pages = pick($node_hash['nova_hugepages_enabled'], false)
|
||||
$libvirt_type = hiera('libvirt_type', undef)
|
||||
|
||||
$dpdk_config = hiera_hash('dpdk', {})
|
||||
$enable_dpdk = pick($dpdk_config['enabled'], false)
|
||||
@ -108,8 +109,10 @@ $floating_hash = {}
|
||||
##CALCULATED PARAMETERS
|
||||
|
||||
# TODO(xarses): Wait Nova compute uses memcache?
|
||||
$memcached_server = hiera('memcached_addresses')
|
||||
$memcached_port = hiera('memcache_server_port', '11211')
|
||||
$cache_server_ip = hiera('memcached_addresses')
|
||||
$cache_server_port = hiera('memcache_server_port', '11211')
|
||||
$memcached_addresses = suffix($cache_server_ip, inline_template(":<%= @cache_server_port %>"))
|
||||
|
||||
|
||||
# TODO(xarses): We need to validate this is needed
|
||||
if ($storage_hash['volumes_lvm']) {
|
||||
@ -136,42 +139,7 @@ $r_hostmem = roles_include(['ceph-osd']) ? {
|
||||
$mirror_type = 'external'
|
||||
Exec { logoutput => true }
|
||||
|
||||
$oc_nova_hash = merge({ 'reserved_host_memory' => $r_hostmem }, $nova_hash)
|
||||
|
||||
# NOTE(bogdando) deploy compute node with disabled nova-compute
|
||||
# service #LP1398817. The orchestration will start and enable it back
|
||||
# after the deployment is done.
|
||||
# FIXME(bogdando) This should be changed once the host aggregates implemented, bp disable-new-computes
|
||||
class { '::openstack::compute':
|
||||
enabled => false,
|
||||
internal_address => get_network_role_property('nova/api', 'ipaddr'),
|
||||
libvirt_type => hiera('libvirt_type', undef),
|
||||
rpc_backend => $rpc_backend_real,
|
||||
amqp_hosts => hiera('amqp_hosts',''),
|
||||
amqp_user => pick($rabbit_hash['user'], 'nova'),
|
||||
amqp_password => $rabbit_hash['password'],
|
||||
glance_api_servers => $glance_api_servers,
|
||||
vncproxy_protocol => $vncproxy_protocol,
|
||||
vncproxy_host => $vncproxy_host,
|
||||
debug => $debug,
|
||||
verbose => $verbose,
|
||||
use_stderr => $use_stderr,
|
||||
nova_hash => $oc_nova_hash,
|
||||
cache_server_ip => $memcached_server,
|
||||
cache_server_port => $memcached_port,
|
||||
notification_driver => $ceilometer_hash['notification_driver'],
|
||||
pci_passthrough => nic_whitelist_to_json(get_nic_passthrough_whitelist('sriov')),
|
||||
network_device_mtu => $network_device_mtu,
|
||||
use_syslog => $use_syslog,
|
||||
syslog_log_facility => $syslog_log_facility,
|
||||
nova_report_interval => $nova_hash['nova_report_interval'],
|
||||
nova_service_down_time => $nova_hash['nova_service_down_time'],
|
||||
state_path => $nova_hash[state_path],
|
||||
storage_hash => $storage_hash,
|
||||
config_drive_format => $config_drive_format,
|
||||
use_huge_pages => $use_huge_pages,
|
||||
vcpu_pin_set => $nova_hash['cpu_pinning'],
|
||||
}
|
||||
$nova_hash_real = merge({ 'reserved_host_memory' => $r_hostmem }, $nova_hash)
|
||||
|
||||
# Required for fping API extension, see LP#1486404
|
||||
ensure_packages('fping')
|
||||
@ -193,5 +161,349 @@ class {'::nova::config':
|
||||
|
||||
########################################################################
|
||||
|
||||
include ::nova::params
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
# From legacy libvirt.pp
|
||||
exec { 'symlink-qemu-kvm':
|
||||
command => '/bin/ln -sf /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64',
|
||||
creates => '/usr/bin/qemu-system-x86_64',
|
||||
}
|
||||
|
||||
package { 'avahi':
|
||||
ensure => present;
|
||||
}
|
||||
|
||||
service { 'avahi-daemon':
|
||||
ensure => running,
|
||||
require => Package['avahi'];
|
||||
}
|
||||
|
||||
Package['avahi'] ->
|
||||
Service['messagebus'] ->
|
||||
Service['avahi-daemon'] ->
|
||||
Service['libvirt']
|
||||
|
||||
service { 'libvirt-guests':
|
||||
name => 'libvirt-guests',
|
||||
enable => false,
|
||||
ensure => true,
|
||||
hasstatus => false,
|
||||
hasrestart => false,
|
||||
}
|
||||
|
||||
# From legacy params.pp
|
||||
$libvirt_type_kvm = 'qemu-kvm'
|
||||
$guestmount_package_name = 'libguestfs-tools-c'
|
||||
|
||||
# From legacy utilities.pp
|
||||
package { ['unzip', 'curl', 'euca2ools']:
|
||||
ensure => present
|
||||
}
|
||||
if !(defined(Package['parted'])) {
|
||||
package {'parted': ensure => 'present' }
|
||||
}
|
||||
|
||||
package {$guestmount_package_name: ensure => present}
|
||||
}
|
||||
'Debian': {
|
||||
|
||||
# From legacy params
|
||||
$libvirt_type_kvm = 'qemu-kvm'
|
||||
$guestmount_package_name = 'guestmount'
|
||||
}
|
||||
default: { fail("Unsupported osfamily: ${::osfamily}") }
|
||||
}
|
||||
|
||||
if $::osfamily == 'Debian' {
|
||||
if $use_huge_pages {
|
||||
$qemu_hugepages_value = 'set KVM_HUGEPAGES 1'
|
||||
$libvirt_hugetlbfs_mount = 'set hugetlbfs_mount /run/hugepages/kvm'
|
||||
} else {
|
||||
$qemu_hugepages_value = 'rm KVM_HUGEPAGES'
|
||||
$libvirt_hugetlbfs_mount = 'rm hugetlbfs_mount'
|
||||
}
|
||||
augeas { 'qemu_hugepages':
|
||||
context => '/files/etc/default/qemu-kvm',
|
||||
changes => $qemu_hugepages_value,
|
||||
notify => Service['libvirt'],
|
||||
}
|
||||
augeas { 'libvirt_hugetlbfs_mount':
|
||||
context => '/files/etc/libvirt/qemu.conf',
|
||||
changes => $libvirt_hugetlbfs_mount,
|
||||
notify => Service['libvirt'],
|
||||
}
|
||||
|
||||
Augeas['qemu_hugepages'] ~> Service<| title == 'qemu-kvm'|>
|
||||
Service<| title == 'qemu-kvm'|> -> Service<| title == 'libvirt'|>
|
||||
}
|
||||
|
||||
if ($::operatingsystem == 'Ubuntu') and ($libvirt_type =='kvm') {
|
||||
# TODO(skolekonov): Remove when LP#1057024 has been resolved.
|
||||
# https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/1057024
|
||||
file { '/dev/kvm':
|
||||
ensure => present,
|
||||
group => 'kvm',
|
||||
mode => '0660',
|
||||
}
|
||||
Service<| title == 'qemu-kvm'|> -> File['/dev/kvm']
|
||||
}
|
||||
|
||||
$notify_on_state_change = 'vm_and_task_state'
|
||||
|
||||
if $debug {
|
||||
class { 'nova::logging':
|
||||
default_log_levels => {
|
||||
'oslo.messaging' => 'DEBUG',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class { '::nova':
|
||||
rpc_backend => $rpc_backend_real,
|
||||
#FIXME(bogdando) we have to split amqp_hosts until all modules synced
|
||||
rabbit_hosts => split(hiera('amqp_hosts',''), ','),
|
||||
rabbit_userid => pick($rabbit_hash['user'], 'nova'),
|
||||
rabbit_password => $rabbit_hash['password'],
|
||||
kombu_reconnect_delay => '5.0',
|
||||
glance_api_servers => $glance_api_servers,
|
||||
verbose => $verbose,
|
||||
debug => $debug,
|
||||
use_syslog => $use_syslog,
|
||||
use_stderr => $use_stderr,
|
||||
log_facility => $syslog_log_facility,
|
||||
state_path => $nova_hash_real['state_path'],
|
||||
report_interval => $nova_hash_real['nova_report_interval'],
|
||||
service_down_time => $nova_hash_real['nova_service_down_time'],
|
||||
notify_on_state_change => $notify_on_state_change,
|
||||
notification_driver => $ceilometer_hash['notification_driver'],
|
||||
memcached_servers => $memcached_addresses,
|
||||
cinder_catalog_info => pick($nova_hash_real['cinder_catalog_info'], 'volumev2:cinderv2:internalURL'),
|
||||
}
|
||||
|
||||
class {'::nova::availability_zone':
|
||||
default_availability_zone => $nova_hash_real['default_availability_zone'],
|
||||
default_schedule_zone => $nova_hash_real['default_schedule_zone'],
|
||||
}
|
||||
|
||||
if str2bool($::is_virtual) {
|
||||
$libvirt_cpu_mode = 'none'
|
||||
} else {
|
||||
$libvirt_cpu_mode = 'host-model'
|
||||
}
|
||||
# Install / configure nova-compute
|
||||
|
||||
# From legacy ceilometer notifications for nova
|
||||
$instance_usage_audit = true
|
||||
$instance_usage_audit_period = 'hour'
|
||||
|
||||
####### Disable upstart startup on install #######
|
||||
if($::operatingsystem == 'Ubuntu') {
|
||||
tweaks::ubuntu_service_override { 'nova-compute':
|
||||
package_name => "nova-compute-${libvirt_type}",
|
||||
}
|
||||
}
|
||||
|
||||
# NOTE(bogdando) deploy compute node with disabled nova-compute
|
||||
# service #LP1398817. The orchestration will start and enable it back
|
||||
# after the deployment is done.
|
||||
# FIXME(bogdando) This should be changed once the host aggregates implemented, bp disable-new-computes
|
||||
class { '::nova::compute':
|
||||
enabled => false,
|
||||
vncserver_proxyclient_address => get_network_role_property('nova/api', 'ipaddr'),
|
||||
vncproxy_protocol => $vncproxy_protocol,
|
||||
vncproxy_host => $vncproxy_host,
|
||||
vncproxy_port => $nova_hash_real['vncproxy_port'],
|
||||
force_config_drive => $nova_hash_real['force_config_drive'],
|
||||
pci_passthrough => nic_whitelist_to_json(get_nic_passthrough_whitelist('sriov')),
|
||||
network_device_mtu => $network_device_mtu,
|
||||
instance_usage_audit => $instance_usage_audit,
|
||||
instance_usage_audit_period => $instance_usage_audit_period,
|
||||
reserved_host_memory => $nova_hash_real['reserved_host_memory'],
|
||||
config_drive_format => $config_drive_format,
|
||||
allow_resize_to_same_host => true,
|
||||
vcpu_pin_set => $nova_hash_real['cpu_pinning'],
|
||||
}
|
||||
|
||||
nova_config {
|
||||
'libvirt/live_migration_flag': value => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST';
|
||||
'libvirt/block_migration_flag': value => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_NON_SHARED_INC';
|
||||
'DEFAULT/connection_type': value => 'libvirt';
|
||||
}
|
||||
|
||||
if $use_syslog {
|
||||
nova_config {
|
||||
'DEFAULT/use_syslog_rfc_format': value => true;
|
||||
}
|
||||
}
|
||||
|
||||
# The default value for inject_partition is -2, so it will be disabled
|
||||
# when we use Ceph for ephemeral storage or for Cinder. We only need to
|
||||
# modify the libvirt_disk_cachemodes in that case.
|
||||
if ($storage_hash['ephemeral_ceph'] or $storage_hash['volumes_ceph']) {
|
||||
$disk_cachemodes = ['"network=writeback,block=none"']
|
||||
$libvirt_inject_partition = '-2'
|
||||
} else {
|
||||
if $::osfamily == 'RedHat' {
|
||||
$libvirt_inject_partition = '-1'
|
||||
} else {
|
||||
# Enable module by default on each compute node
|
||||
k_mod {'nbd':
|
||||
ensure => 'present'
|
||||
}
|
||||
file_line {'nbd_on_boot':
|
||||
path => '/etc/modules',
|
||||
line => 'nbd',
|
||||
}
|
||||
$libvirt_inject_partition = '1'
|
||||
}
|
||||
$disk_cachemodes = ['"file=directsync,block=none"']
|
||||
}
|
||||
|
||||
# Configure libvirt for nova-compute
|
||||
class { 'nova::compute::libvirt':
|
||||
libvirt_virt_type => $libvirt_type,
|
||||
libvirt_cpu_mode => $libvirt_cpu_mode,
|
||||
libvirt_disk_cachemodes => $disk_cachemodes,
|
||||
libvirt_inject_partition => $libvirt_inject_partition,
|
||||
vncserver_listen => '0.0.0.0',
|
||||
remove_unused_original_minimum_age_seconds => pick($nova_hash_real['remove_unused_original_minimum_age_seconds'], '86400'),
|
||||
libvirt_service_name => $::nova::params::libvirt_service_name,
|
||||
}
|
||||
|
||||
class { 'nova::migration::libvirt':
|
||||
override_uuid => true,
|
||||
}
|
||||
|
||||
# From legacy libvirt.pp
|
||||
if $::operatingsystem == 'Ubuntu' {
|
||||
package { 'cpufrequtils':
|
||||
ensure => present;
|
||||
}
|
||||
file { '/etc/default/cpufrequtils':
|
||||
content => "GOVERNOR=\"performance\"\n",
|
||||
require => Package['cpufrequtils'],
|
||||
notify => Service['cpufrequtils'],
|
||||
}
|
||||
service { 'cpufrequtils':
|
||||
ensure => 'running',
|
||||
enable => true,
|
||||
status => '/bin/true',
|
||||
}
|
||||
|
||||
Package<| title == 'cpufrequtils'|> ~> Service<| title == 'cpufrequtils'|>
|
||||
if !defined(Service['cpufrequtils']) {
|
||||
notify{ "Module ${module_name} cannot notify service cpufrequtils on package update": }
|
||||
}
|
||||
}
|
||||
|
||||
package { $libvirt_type_kvm:
|
||||
ensure => present,
|
||||
before => Package[$::nova::params::compute_package_name],
|
||||
}
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
if $libvirt_type =='kvm' {
|
||||
exec { '/etc/sysconfig/modules/kvm.modules':
|
||||
path => '/sbin:/usr/sbin:/bin:/usr/bin',
|
||||
unless => 'lsmod | grep -q kvm',
|
||||
require => Package[$libvirt_type_kvm],
|
||||
}
|
||||
}
|
||||
}
|
||||
'Debian': {
|
||||
service { 'qemu-kvm':
|
||||
ensure => running,
|
||||
require => Package[$libvirt_type_kvm],
|
||||
subscribe => Package[$libvirt_type_kvm],
|
||||
}
|
||||
}
|
||||
default: { fail("Unsupported osfamily: ${osfamily}") }
|
||||
}
|
||||
|
||||
Service<| title == 'libvirt'|> ~> Service<| title == 'nova-compute'|>
|
||||
Package<| title == "nova-compute-${libvirt_type}"|> ~>
|
||||
Service<| title == 'nova-compute'|>
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
file_line { 'qemu_selinux':
|
||||
path => '/etc/libvirt/qemu.conf',
|
||||
line => 'security_driver = "selinux"',
|
||||
require => Package[$::nova::params::libvirt_package_name],
|
||||
notify => Service['libvirt']
|
||||
}
|
||||
}
|
||||
'Debian': {
|
||||
file_line { 'qemu_apparmor':
|
||||
path => '/etc/libvirt/qemu.conf',
|
||||
line => 'security_driver = "apparmor"',
|
||||
require => Package[$::nova::params::libvirt_package_name],
|
||||
notify => Service['libvirt']
|
||||
}
|
||||
|
||||
file_line { 'apparmor_libvirtd':
|
||||
path => '/etc/apparmor.d/usr.sbin.libvirtd',
|
||||
line => "# unix, # shouldn't be used for libvirt/qemu",
|
||||
match => '^[#[:space:]]*unix',
|
||||
}
|
||||
|
||||
exec { 'refresh_apparmor':
|
||||
refreshonly => true,
|
||||
command => '/sbin/apparmor_parser -r /etc/apparmor.d/usr.sbin.libvirtd',
|
||||
subscribe => File_line['apparmor_libvirtd'],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Package<| title == 'nova-compute'|> ~> Service<| title == 'nova-compute'|>
|
||||
if !defined(Service['nova-compute']) {
|
||||
notify{ "Module ${module_name} cannot notify service nova-compute on packages update": }
|
||||
}
|
||||
|
||||
Package<| title == 'libvirt'|> ~> Service<| title == 'libvirt'|>
|
||||
if !defined(Service['libvirt']) {
|
||||
notify{ "Module ${module_name} cannot notify service libvirt on package update": }
|
||||
}
|
||||
|
||||
include nova::client
|
||||
|
||||
# Ensure ssh clients are installed
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
$scp_package='openssh-client'
|
||||
$multipath_tools_package='multipath-tools'
|
||||
}
|
||||
'RedHat': {
|
||||
$scp_package='openssh-clients'
|
||||
$multipath_tools_package='device-mapper-multipath'
|
||||
}
|
||||
default: { fail("Unsupported osfamily: ${osfamily}") }
|
||||
}
|
||||
|
||||
ensure_packages([$scp_package, $multipath_tools_package])
|
||||
|
||||
$ssh_private_key = '/var/lib/astute/nova/nova'
|
||||
$ssh_public_key = '/var/lib/astute/nova/nova.pub'
|
||||
|
||||
# Install ssh keys and config file
|
||||
install_ssh_keys {'nova_ssh_key_for_migration':
|
||||
ensure => present,
|
||||
user => 'nova',
|
||||
private_key_path => $ssh_private_key,
|
||||
public_key_path => $ssh_public_key,
|
||||
private_key_name => 'id_rsa',
|
||||
public_key_name => 'id_rsa.pub',
|
||||
authorized_keys => 'authorized_keys',
|
||||
} ->
|
||||
file { '/var/lib/nova/.ssh/config':
|
||||
ensure => present,
|
||||
owner => 'nova',
|
||||
group => 'nova',
|
||||
mode => '0600',
|
||||
content => "Host *\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null\n",
|
||||
}
|
||||
|
||||
# vim: set ts=2 sw=2 et :
|
||||
|
@ -46,6 +46,10 @@ describe manifest do
|
||||
Noop.hiera_structure 'nova'
|
||||
end
|
||||
|
||||
let(:compute_hash) do
|
||||
Noop.hiera_hash 'compute', {}
|
||||
end
|
||||
|
||||
let(:storage_hash) do
|
||||
Noop.hiera_structure 'storage'
|
||||
end
|
||||
@ -67,8 +71,15 @@ describe manifest do
|
||||
Noop.puppet_function('get_nic_passthrough_whitelist', 'sriov')
|
||||
end
|
||||
|
||||
let(:nova_report_interval) { Noop.puppet_function 'pick', nova_hash['nova_report_interval'], nil }
|
||||
let(:nova_service_down_time) { Noop.puppet_function 'pick', nova_hash['nova_service_down_time'], nil }
|
||||
let(:nova_report_interval) { Noop.puppet_function 'pick', nova_hash['nova_report_interval'], '10' }
|
||||
let(:nova_service_down_time) { Noop.puppet_function 'pick', nova_hash['nova_service_down_time'], '60' }
|
||||
|
||||
|
||||
let(:verbose) { Noop.puppet_function 'pick', compute_hash['verbose'], 'true' }
|
||||
let(:global_debug) { Noop.hiera 'debug', 'true' }
|
||||
let(:debug) { Noop.puppet_function 'pick', compute_hash['debug'], global_debug }
|
||||
let(:log_facility) { Noop.hiera 'syslog_log_facility_nova', 'LOG_LOCAL6' }
|
||||
|
||||
|
||||
# Legacy openstack-compute tests
|
||||
|
||||
@ -140,8 +151,8 @@ describe manifest do
|
||||
it 'should configure libvirt host_uuid' do
|
||||
host_uuid = facts[:libvirt_uuid]
|
||||
should contain_augeas('libvirt-conf-uuid').with(
|
||||
:context => '/files/etc/libvirt/libvirtd.conf',
|
||||
:changes => "set host_uuid #{host_uuid}"
|
||||
'context' => '/files/etc/libvirt/libvirtd.conf',
|
||||
'changes' => "set host_uuid #{host_uuid}"
|
||||
).that_notifies('Service[libvirt]')
|
||||
end
|
||||
|
||||
@ -275,14 +286,14 @@ describe manifest do
|
||||
'value' => 'true',
|
||||
)
|
||||
end
|
||||
it 'nova config should have report_interval set to 60' do
|
||||
it 'nova config should have report_interval' do
|
||||
should contain_nova_config('DEFAULT/report_interval').with(
|
||||
'value' => '60',
|
||||
'value' => nova_report_interval,
|
||||
)
|
||||
end
|
||||
it 'nova config should have service_down_time set to 180' do
|
||||
it 'nova config should have service_down_time' do
|
||||
should contain_nova_config('DEFAULT/service_down_time').with(
|
||||
'value' => '180',
|
||||
'value' => nova_service_down_time,
|
||||
)
|
||||
end
|
||||
it 'nova config should have use_stderr set to false' do
|
||||
@ -334,7 +345,6 @@ describe manifest do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# SSL support
|
||||
management_vip = Noop.hiera('management_vip')
|
||||
glance_api_servers = "#{management_vip}:9292"
|
||||
@ -352,17 +362,18 @@ describe manifest do
|
||||
vncproxy_protocol = 'http'
|
||||
end
|
||||
|
||||
let(:vncproxy_port) { Noop.puppet_function 'pick', nova_hash['vncproxy_port'], '6080' }
|
||||
|
||||
it 'should properly configure vncproxy with (non-)ssl' do
|
||||
should contain_class('openstack::compute').with(
|
||||
'vncproxy_host' => vncproxy_host
|
||||
)
|
||||
should contain_class('nova::compute').with(
|
||||
'vncproxy_protocol' => vncproxy_protocol
|
||||
'vncproxy_protocol' => vncproxy_protocol,
|
||||
'vncproxy_host' => vncproxy_host,
|
||||
'vncproxy_port' => vncproxy_port,
|
||||
)
|
||||
end
|
||||
|
||||
it 'should properly configure glance api servers with (non-)ssl' do
|
||||
should contain_class('openstack::compute').with(
|
||||
should contain_class('nova').with(
|
||||
'glance_api_servers' => glance_api_servers
|
||||
)
|
||||
end
|
||||
@ -373,16 +384,24 @@ describe manifest do
|
||||
should contain_class('nova::compute').with('pci_passthrough' => pci_passthrough_json)
|
||||
end
|
||||
|
||||
it 'should configure logging when debug is enabled' do
|
||||
if debug
|
||||
default_log_levels = {
|
||||
'oslo.messaging' => 'DEBUG',
|
||||
}
|
||||
|
||||
should contain_class('nova::logging').with(
|
||||
'default_log_levels' => default_log_levels,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
# Check out nova config params
|
||||
it 'should properly configure nova' do
|
||||
|
||||
node_name = Noop.hiera('node_name')
|
||||
network_metadata = Noop.hiera_hash('network_metadata')
|
||||
roles = network_metadata['nodes'][node_name]['node_roles']
|
||||
nova_hash.merge!({'vncproxy_protocol' => vncproxy_protocol,
|
||||
'nova_report_interval' => nova_report_interval,
|
||||
'nova_service_down_time'=> nova_service_down_time,
|
||||
})
|
||||
|
||||
if roles.include? 'ceph-osd'
|
||||
nova_compute_rhostmem = rhost_mem['reserved_host_memory']
|
||||
@ -391,13 +410,80 @@ describe manifest do
|
||||
nova_compute_rhostmem = 512 # default
|
||||
end
|
||||
|
||||
should contain_class('openstack::compute').with(
|
||||
'nova_hash' => rhost_mem.merge(nova_hash)
|
||||
)
|
||||
should contain_class('nova::compute').with(
|
||||
'reserved_host_memory' => nova_compute_rhostmem
|
||||
)
|
||||
end
|
||||
|
||||
let(:default_availability_zone) { Noop.puppet_function 'pick', nova_hash['default_availability_zone'], facts[:os_service_default] }
|
||||
let(:default_schedule_zone) { Noop.puppet_function 'pick', nova_hash['default_schedule_zone'], facts[:os_service_default] }
|
||||
|
||||
it 'should configure availability zones' do
|
||||
should contain_class('nova::availability_zone').with(
|
||||
'default_availability_zone' => default_availability_zone,
|
||||
'default_schedule_zone' => default_schedule_zone,
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures with the default params' do
|
||||
|
||||
should contain_class('nova').with(
|
||||
'kombu_reconnect_delay' => '5.0',
|
||||
'verbose' => verbose,
|
||||
'debug' => debug,
|
||||
'log_facility' => log_facility,
|
||||
'state_path' => nova_hash['state_path'],
|
||||
'notify_on_state_change' => 'vm_and_task_state',
|
||||
)
|
||||
should contain_class('nova::compute').with(
|
||||
'enabled' => 'false',
|
||||
'instance_usage_audit' => 'true',
|
||||
'instance_usage_audit_period' => 'hour',
|
||||
'config_drive_format' => 'vfat'
|
||||
)
|
||||
|
||||
min_age = Noop.puppet_function 'pick', nova_hash['remove_unused_original_minimum_age_seconds'], '86400'
|
||||
should contain_class('nova::compute::libvirt').with(
|
||||
'libvirt_virt_type' => libvirt_type,
|
||||
'vncserver_listen' => '0.0.0.0',
|
||||
'remove_unused_original_minimum_age_seconds' => min_age,
|
||||
)
|
||||
end
|
||||
|
||||
it 'should contain migration basics' do
|
||||
should contain_class('nova::client')
|
||||
should contain_install_ssh_keys('nova_ssh_key_for_migration')
|
||||
should contain_file('/var/lib/nova/.ssh/config')
|
||||
end
|
||||
|
||||
it 'should contain cpufrequtils' do
|
||||
if facts[:operatingsystem] == 'Ubuntu'
|
||||
should contain_package('cpufrequtils').with(
|
||||
'ensure' => 'present'
|
||||
)
|
||||
should contain_file('/etc/default/cpufrequtils').with(
|
||||
'content' => "GOVERNOR=\"performance\"\n",
|
||||
'require' => 'Package[cpufrequtils]',
|
||||
'notify' => 'Service[cpufrequtils]',
|
||||
)
|
||||
should contain_service('cpufrequtils').with(
|
||||
'ensure' => 'running',
|
||||
'enable' => 'true',
|
||||
'status' => '/bin/true',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'should contain ssh and multipath packages' do
|
||||
if facts[:osfamily] == 'Debian'
|
||||
packages = ['openssh-client', 'multipath-tools']
|
||||
elsif facts[:osfamily] == 'RedHat'
|
||||
packages = ['openssh-clients', 'device-mapper-multipath']
|
||||
end
|
||||
packages.each do |p|
|
||||
should contain_package(p)
|
||||
end
|
||||
end
|
||||
|
||||
test_ubuntu_and_centos manifest
|
||||
|
Loading…
Reference in New Issue
Block a user