Add hooks for external install & svc management

This adds defined anchor points for external modules to hook into the
software install, config and service dependency chain.  This allows
external modules to manage software installation (virtualenv,
containers, etc) and service management (pacemaker) without needing rely
on resources that may change or be renamed.

Change-Id: I0b524e354b095f2642fd38a2f88536d15bcdf855
This commit is contained in:
Clayton O'Neill 2015-11-16 02:55:39 +00:00 committed by Clayton O'Neill
parent 02f5b94ff2
commit cb77bc295f
56 changed files with 291 additions and 185 deletions

View File

@ -217,20 +217,13 @@ class nova::api(
$conductor_workers = undef,
) {
include ::nova::deps
include ::nova::db
include ::nova::params
include ::nova::policy
require ::keystone::python
include ::cinder::client
Package<| title == 'nova-common' |> -> Class['nova::api']
Package<| title == 'nova-common' |> -> Class['nova::policy']
Nova_paste_api_ini<| |> ~> Exec['post-nova_config']
Nova_paste_api_ini<| |> ~> Service['nova-api']
Class['nova::policy'] ~> Service['nova-api']
if $conductor_workers {
warning('The conductor_workers parameter is deprecated and has no effect. Use workers parameter of nova::conductor class instead.')
}

View File

@ -172,6 +172,7 @@ class nova::cells (
$weight_scale = '1.0'
) {
include ::nova::deps
include ::nova::params
case $cell_type {

View File

@ -22,6 +22,7 @@ class nova::cert(
$ensure_package = 'present'
) {
include ::nova::deps
include ::nova::params
nova::generic_service { 'cert':

View File

@ -11,10 +11,11 @@
class nova::client(
$ensure = 'present'
) {
include ::nova::deps
package { 'python-novaclient':
ensure => $ensure,
tag => ['openstack'],
tag => ['openstack', 'nova-support-package'],
}
}

View File

@ -150,6 +150,7 @@ class nova::compute (
$allow_resize_to_same_host = false,
) {
include ::nova::deps
include ::nova::params
nova_config {
@ -173,7 +174,7 @@ class nova::compute (
# Install bridge-utils if we use nova-network
package { 'bridge-utils':
ensure => present,
before => Nova::Generic_service['compute'],
tag => ['openstack', 'nova-support-package'],
}
}
@ -221,6 +222,7 @@ class nova::compute (
package { 'pm-utils':
ensure => present,
tag => ['openstack', 'nova-support-package'],
}
nova_config {

View File

@ -46,6 +46,8 @@ class nova::compute::ironic (
$compute_driver = 'ironic.IronicDriver'
) {
include ::nova::deps
if $admin_user {
warning('The admin_user parameter is deprecated, use admin_username instead.')
}

View File

@ -106,6 +106,7 @@ class nova::compute::libvirt (
$compute_driver = 'libvirt.LibvirtDriver'
) inherits nova::params {
include ::nova::deps
include ::nova::params
Service['libvirt'] -> Service['nova-compute']
@ -126,10 +127,8 @@ class nova::compute::libvirt (
if($::osfamily == 'Debian') {
package { "nova-compute-${libvirt_virt_type}":
ensure => present,
before => Package['nova-compute'],
require => Package['nova-common'],
tag => ['openstack'],
ensure => present,
tag => ['openstack', 'nova-package'],
}
}
@ -156,6 +155,7 @@ class nova::compute::libvirt (
ensure => present,
name => $::nova::params::libvirt_nwfilter_package_name,
before => Service['libvirt'],
tag => ['openstack', 'nova-support-package'],
}
case $libvirt_virt_type {
'qemu': {
@ -172,6 +172,7 @@ class nova::compute::libvirt (
package { 'libvirt':
ensure => present,
name => $libvirt_package_name_real,
tag => ['openstack', 'nova-support-package'],
}
service { 'libvirt' :
@ -179,7 +180,7 @@ class nova::compute::libvirt (
enable => true,
name => $libvirt_service_name,
provider => $::nova::params::special_service_provider,
require => Package['libvirt'],
require => Anchor['nova::config::end'],
}
nova_config {

View File

@ -19,6 +19,7 @@ class nova::compute::neutron (
$libvirt_vif_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver',
$force_snat_range = '0.0.0.0/0',
) {
include ::nova::deps
if $libvirt_vif_driver == 'nova.virt.libvirt.vif.LibvirtOpenVswitchDriver' {
fail('nova.virt.libvirt.vif.LibvirtOpenVswitchDriver as vif_driver is removed from Icehouse')

View File

@ -65,6 +65,7 @@ class nova::compute::rbd (
$ephemeral_storage = true,
) {
include ::nova::deps
include ::nova::params
nova_config {
@ -78,7 +79,7 @@ class nova::compute::rbd (
file { '/etc/nova/secret.xml':
content => template('nova/secret.xml-compute.erb'),
require => Class['::nova']
require => Anchor['nova::config::begin'],
}
exec { 'get-or-set virsh secret':
@ -95,9 +96,9 @@ class nova::compute::rbd (
exec { 'set-secret-value virsh':
command => "/usr/bin/virsh secret-set-value --secret ${libvirt_rbd_secret_uuid} --base64 ${libvirt_key}",
unless => "/usr/bin/virsh secret-get-value ${libvirt_rbd_secret_uuid}",
require => Exec['get-or-set virsh secret']
require => Exec['get-or-set virsh secret'],
before => Achor['nova::config::end'],
}
}
if $ephemeral_storage {

View File

@ -28,6 +28,7 @@ class nova::compute::serial(
$proxyclient_address = '127.0.0.1',
) {
include ::nova::deps
nova_config {
'serial_console/enabled': value => true;

View File

@ -48,6 +48,8 @@ class nova::compute::spice(
$proxy_path = '/spice_auto.html'
) {
include ::nova::deps
if $proxy_host {
$html5proxy_base_url = "${proxy_protocol}://${proxy_host}:${proxy_port}${proxy_path}"
nova_config {

View File

@ -60,6 +60,8 @@ class nova::compute::vmware(
$compute_driver = 'vmwareapi.VMwareVCDriver'
) {
include ::nova::deps
nova_config {
'DEFAULT/compute_driver': value => $compute_driver;
'VMWARE/host_ip': value => $host_ip;
@ -79,6 +81,7 @@ class nova::compute::vmware(
}
package { 'python-suds':
ensure => present
ensure => present,
tag => ['openstack', 'nova-support-package'],
}
}

View File

@ -29,6 +29,8 @@ class nova::compute::xenserver(
$xenapi_inject_image = undef,
) {
include ::nova::deps
if $xenapi_inject_image != undef {
warning('The xenapi_inject_image parameter is deprecated and has no effect.')
}
@ -44,7 +46,8 @@ class nova::compute::xenserver(
package { 'xenapi':
ensure => present,
provider => pip
provider => pip,
tag => ['openstack', 'nova-support-package'],
}
Package['python-pip'] -> Package['xenapi']

View File

@ -32,6 +32,7 @@ class nova::conductor(
$use_local = false,
) {
include ::nova::deps
include ::nova::db
include ::nova::params

View File

@ -32,6 +32,8 @@ class nova::config (
$nova_paste_api_ini = {},
) {
include ::nova::deps
validate_hash($nova_config)
validate_hash($nova_paste_api_ini)

View File

@ -25,6 +25,7 @@ class nova::consoleauth(
$ensure_package = 'present'
) {
include ::nova::deps
include ::nova::params
nova::generic_service { 'consoleauth':
@ -33,7 +34,6 @@ class nova::consoleauth(
package_name => $::nova::params::consoleauth_package_name,
service_name => $::nova::params::consoleauth_service_name,
ensure_package => $ensure_package,
require => Package['nova-common'],
}
}

View File

@ -60,6 +60,8 @@ class nova::cron::archive_deleted_rows (
$destination = '/var/log/nova/nova-rowsflush.log'
) {
include ::nova::deps
cron { 'nova-manage db archive_deleted_rows':
command => "nova-manage db archive_deleted_rows --max_rows ${max_rows} >>${destination} 2>&1",
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
@ -69,6 +71,6 @@ class nova::cron::archive_deleted_rows (
monthday => $monthday,
month => $month,
weekday => $weekday,
require => Package['nova-common'],
require => Anchor['nova::dbsync::end']
}
}

View File

@ -65,6 +65,7 @@ class nova::db (
$database_max_overflow = $::os_service_default,
) {
include ::nova::deps
include ::nova::params
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
@ -109,7 +110,7 @@ class nova::db (
package {'nova-backend-package':
ensure => present,
name => $backend_package,
tag => 'openstack',
tag => ['openstack', 'nova-package'],
}
}

View File

@ -41,6 +41,8 @@ class nova::db::mysql(
$allowed_hosts = undef,
) {
include ::nova::deps
::openstacklib::db::mysql { 'nova':
user => $user,
password_hash => mysql_password($password),
@ -51,5 +53,7 @@ class nova::db::mysql(
allowed_hosts => $allowed_hosts,
}
::Openstacklib::Db::Mysql['nova'] ~> Exec<| title == 'nova-db-sync' |>
Anchor['nova::db::begin']
~> Class['nova::db::mysql']
~> Anchor['nova::db::end']
}

View File

@ -32,6 +32,8 @@ class nova::db::postgresql(
$privileges = 'ALL',
) {
include ::nova::deps
::openstacklib::db::postgresql { 'nova':
password_hash => postgresql_password($user, $password),
dbname => $dbname,
@ -40,7 +42,7 @@ class nova::db::postgresql(
privileges => $privileges,
}
::Openstacklib::Db::Postgresql['nova'] ~> Exec<| title == 'nova-db-sync' |>
::Openstacklib::Db::Postgresql['nova'] -> Anchor<| title == 'nova-start' |>
Anchor['nova::db::begin']
~> Class['nova::db::postgresql']
~> Anchor['nova::db::end']
}

View File

@ -13,20 +13,18 @@ class nova::db::sync(
$extra_params = undef,
) {
include ::nova::deps
include ::nova::params
Package<| tag =='nova-package' |> ~> Exec['nova-db-sync']
Exec['nova-db-sync'] ~> Service <| tag == 'nova-service' |>
Nova_config <||> -> Exec['nova-db-sync']
Nova_config <| title == 'database/connection' |> ~> Exec['nova-db-sync']
Exec<| title == 'post-nova_config' |> ~> Exec['nova-db-sync']
exec { 'nova-db-sync':
command => "/usr/bin/nova-manage ${extra_params} db sync",
refreshonly => true,
logoutput => on_failure,
subscribe => [
Anchor['nova::install::end'],
Anchor['nova::config::end'],
Anchor['nova::dbsync::begin']
],
notify => Anchor['nova::dbsync::end'],
}
}

63
manifests/deps.pp Normal file
View File

@ -0,0 +1,63 @@
# == Class: nova::deps
#
# Nova anchors and dependency management
#
class nova::deps {
# Setup anchors for install, config and service phases of the module. These
# anchors allow external modules to hook the begin and end of any of these
# phases. Package or service management can also be replaced by ensuring the
# package is absent or turning off service management and having the
# replacement depend on the appropriate anchors. When applicable, end tags
# should be notified so that subscribers can determine if installation,
# config or service state changed and act on that if needed.
anchor { 'nova::install::begin': }
-> Package<| tag == 'nova-package'|>
~> anchor { 'nova::install::end': }
-> anchor { 'nova::config::begin': }
-> Nova_config<||>
~> anchor { 'nova::config::end': }
-> anchor { 'nova::db::begin': }
-> anchor { 'nova::db::end': }
~> anchor { 'nova::dbsync::begin': }
-> anchor { 'nova::dbsync::end': }
~> anchor { 'nova::service::begin': }
~> Service<| tag == 'nova-service' |>
~> anchor { 'nova::service::end': }
# paste-api.ini config shold occur in the config block also.
Anchor['nova::config::begin']
-> Nova_paste_api_ini<||>
~> Anchor['nova::config::end']
# Support packages need to be installed in the install phase, but we don't
# put them in the chain above because we don't want any false dependencies
# between packages with the nova-package tag and the nova-support-package
# tag. Note: the package resources here will have a 'before' relationshop on
# the nova::install::end anchor. The line between nova-support-package and
# nova-package should be whether or not Nova services would need to be
# restarted if the package state was changed.
Anchor['nova::install::begin']
-> Package<| tag == 'nova-support-package'|>
-> Anchor['nova::install::end']
# The following resourcs are managed by calling 'nova manage' and so the
# database must be provisioned before they can be applied.
Anchor['nova::dbsync::end']
-> Nova_cells<||>
Anchor['nova::dbsync::end']
-> Nova_floating<||>
Anchor['nova::dbsync::end']
-> Nova_network<||>
# Installation or config changes will always restart services.
Anchor['nova::install::end'] ~> Anchor['nova::service::begin']
Anchor['nova::config::end'] ~> Anchor['nova::service::begin']
# This is here for backwards compatability for any external users of the
# nova-start anchor. This should be considered deprecated and removed in the
# N cycle
anchor { 'nova-start':
require => Anchor['nova::install::end'],
before => Anchor['nova::config::begin'],
}
}

View File

@ -38,16 +38,10 @@ define nova::generic_service(
$ensure_package = 'present'
) {
include ::nova::deps
include ::nova::params
$nova_title = "nova-${name}"
# ensure that the service is only started after
# all nova config entries have been set
Exec['post-nova_config'] ~> Service<| title == $nova_title |>
# ensure that the service has only been started
# after the initial db sync
Exec<| title == 'nova-db-sync' |> ~> Service<| title == $nova_title |>
# I need to mark that ths package should be
# installed before nova_config
@ -56,18 +50,9 @@ define nova::generic_service(
package { $nova_title:
ensure => $ensure_package,
name => $package_name,
notify => Service[$nova_title],
tag => ['openstack', 'nova-package'],
}
}
if $service_name {
# Do the dependency relationship here in case the package
# has been defined elsewhere, either as Package[$nova_title]
# or Package[$package_name]
Package<| title == $nova_title |> -> Service[$nova_title]
Package<| title == $package_name |> -> Service[$nova_title]
}
}
if $service_name {
@ -84,7 +69,6 @@ define nova::generic_service(
name => $service_name,
enable => $enabled,
hasstatus => true,
require => [Package['nova-common']],
tag => 'nova-service',
}
}

View File

@ -409,6 +409,8 @@ class nova(
$qpid_tcp_nodelay = undef,
) inherits nova::params {
include ::nova::deps
# maintain backward compatibility
include ::nova::db
include ::nova::logging
@ -446,7 +448,8 @@ class nova(
mode => '0700',
owner => 'nova',
group => 'nova',
require => Package['nova-common'],
require => Anchor['nova::config::begin'],
before => Anchor['nova::config::end'],
}
if $nova_public_key {
@ -484,37 +487,27 @@ class nova(
mode => '0600',
owner => 'nova',
group => 'nova',
require => [ File['/var/lib/nova/.ssh'], Package['nova-common'] ],
require => File['/var/lib/nova/.ssh'],
}
}
}
Nova_config<| |> ~> Exec['post-nova_config']
if $install_utilities {
class { '::nova::utilities': }
}
# this anchor is used to simplify the graph between nova components by
# allowing a resource to serve as a point where the configuration of nova begins
anchor { 'nova-start': }
package { 'python-nova':
ensure => $ensure_package,
tag => ['openstack'],
tag => ['openstack', 'nova-package'],
}
package { 'nova-common':
ensure => $ensure_package,
name => $::nova::params::common_package_name,
require => [Package['python-nova'], Anchor['nova-start']],
require => Package['python-nova'],
tag => ['openstack', 'nova-package'],
}
file { '/etc/nova/nova.conf':
require => Package['nova-common'],
}
# used by debian/ubuntu in nova::network_bridge to refresh
# interfaces based on /etc/network/interfaces
exec { 'networking-refresh':
@ -781,10 +774,4 @@ class nova(
nova_config {
'DEFAULT/os_region_name': ensure => absent;
}
exec { 'post-nova_config':
command => '/bin/echo "Nova config has changed"',
refreshonly => true,
}
}

View File

@ -188,6 +188,8 @@ class nova::keystone::auth(
$internal_address = undef,
) {
include ::nova::deps
if $compute_version {
warning('The compute_version parameter is deprecated, use public_url, internal_url and admin_url instead.')
}

View File

@ -110,6 +110,8 @@ class nova::logging(
$log_date_format = $::os_service_default,
) {
include ::nova::deps
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
# to use nova::<myparam> first then nova::logging::<myparam>.
$use_syslog_real = pick($::nova::use_syslog,$use_syslog)

View File

@ -71,8 +71,7 @@ define nova::manage::cells (
$weight_scale = '1.0'
) {
File['/etc/nova/nova.conf'] -> Nova_cells[$name]
Exec<| title == 'nova-db-sync' |> -> Nova_cells[$name]
include ::nova::deps
nova_cells { $name:
ensure => present,

View File

@ -7,13 +7,11 @@
#
define nova::manage::floating ( $network ) {
File['/etc/nova/nova.conf'] -> Nova_floating[$name]
Exec<| title == 'nova-db-sync' |> -> Nova_floating[$name]
include ::nova::deps
nova_floating { $name:
ensure => present,
network => $network,
provider => 'nova_manage',
}
}

View File

@ -52,8 +52,7 @@ define nova::manage::network (
$dns2 = undef
) {
File['/etc/nova/nova.conf'] -> Nova_network[$name]
Exec<| title == 'nova-db-sync' |> -> Nova_network[$name]
include ::nova::deps
nova_network { $name:
ensure => present,

View File

@ -27,6 +27,9 @@ class nova::migration::libvirt(
$live_migration_flag = undef,
$block_migration_flag = undef,
){
include ::nova::deps
if $use_tls {
$listen_tls = '1'
$listen_tcp = '0'
@ -52,89 +55,90 @@ class nova::migration::libvirt(
validate_re($auth, [ '^sasl$', '^none$' ], 'Valid options for auth are none and sasl.')
Package['libvirt'] -> File_line<| path == '/etc/libvirt/libvirtd.conf' |>
Anchor['nova::config::begin']
-> File_line<| tag == 'libvirt-file_line'|>
-> Anchor['nova::config::end']
File_line<| tag == 'libvirt-file_line' |>
~> Service['libvirt']
case $::osfamily {
'RedHat': {
file_line { '/etc/libvirt/libvirtd.conf listen_tls':
path => '/etc/libvirt/libvirtd.conf',
line => "listen_tls = ${listen_tls}",
match => 'listen_tls =',
notify => Service['libvirt'],
path => '/etc/libvirt/libvirtd.conf',
line => "listen_tls = ${listen_tls}",
match => 'listen_tls =',
tag => 'libvirt-file_line',
}
file_line { '/etc/libvirt/libvirtd.conf listen_tcp':
path => '/etc/libvirt/libvirtd.conf',
line => "listen_tcp = ${listen_tcp}",
match => 'listen_tcp =',
notify => Service['libvirt'],
path => '/etc/libvirt/libvirtd.conf',
line => "listen_tcp = ${listen_tcp}",
match => 'listen_tcp =',
tag => 'libvirt-file_line',
}
if $use_tls {
file_line { '/etc/libvirt/libvirtd.conf auth_tls':
path => '/etc/libvirt/libvirtd.conf',
line => "auth_tls = \"${auth}\"",
match => 'auth_tls =',
notify => Service['libvirt'],
path => '/etc/libvirt/libvirtd.conf',
line => "auth_tls = \"${auth}\"",
match => 'auth_tls =',
tag => 'libvirt-file_line',
}
} else {
file_line { '/etc/libvirt/libvirtd.conf auth_tcp':
path => '/etc/libvirt/libvirtd.conf',
line => "auth_tcp = \"${auth}\"",
match => 'auth_tcp =',
notify => Service['libvirt'],
path => '/etc/libvirt/libvirtd.conf',
line => "auth_tcp = \"${auth}\"",
match => 'auth_tcp =',
tag => 'libvirt-file_line',
}
}
file_line { '/etc/sysconfig/libvirtd libvirtd args':
path => '/etc/sysconfig/libvirtd',
line => 'LIBVIRTD_ARGS="--listen"',
match => 'LIBVIRTD_ARGS=',
notify => Service['libvirt'],
path => '/etc/sysconfig/libvirtd',
line => 'LIBVIRTD_ARGS="--listen"',
match => 'LIBVIRTD_ARGS=',
tag => 'libvirt-file_line',
}
Package['libvirt'] -> File_line<| path == '/etc/sysconfig/libvirtd' |>
}
'Debian': {
file_line { '/etc/libvirt/libvirtd.conf listen_tls':
path => '/etc/libvirt/libvirtd.conf',
line => "listen_tls = ${listen_tls}",
match => 'listen_tls =',
notify => Service['libvirt'],
path => '/etc/libvirt/libvirtd.conf',
line => "listen_tls = ${listen_tls}",
match => 'listen_tls =',
tag => 'libvirt-file_line',
}
file_line { '/etc/libvirt/libvirtd.conf listen_tcp':
path => '/etc/libvirt/libvirtd.conf',
line => "listen_tcp = ${listen_tcp}",
match => 'listen_tcp =',
notify => Service['libvirt'],
path => '/etc/libvirt/libvirtd.conf',
line => "listen_tcp = ${listen_tcp}",
match => 'listen_tcp =',
tag => 'libvirt-file_line',
}
if $use_tls {
file_line { '/etc/libvirt/libvirtd.conf auth_tls':
path => '/etc/libvirt/libvirtd.conf',
line => "auth_tls = \"${auth}\"",
match => 'auth_tls =',
notify => Service['libvirt'],
path => '/etc/libvirt/libvirtd.conf',
line => "auth_tls = \"${auth}\"",
match => 'auth_tls =',
tag => 'libvirt-file_line',
}
} else {
file_line { '/etc/libvirt/libvirtd.conf auth_tcp':
path => '/etc/libvirt/libvirtd.conf',
line => "auth_tcp = \"${auth}\"",
match => 'auth_tcp =',
notify => Service['libvirt'],
path => '/etc/libvirt/libvirtd.conf',
line => "auth_tcp = \"${auth}\"",
match => 'auth_tcp =',
tag => 'libvirt-file_line',
}
}
file_line { "/etc/default/${::nova::compute::libvirt::libvirt_service_name} libvirtd opts":
path => "/etc/default/${::nova::compute::libvirt::libvirt_service_name}",
line => 'libvirtd_opts="-d -l"',
match => 'libvirtd_opts=',
notify => Service['libvirt'],
path => "/etc/default/${::nova::compute::libvirt::libvirt_service_name}",
line => 'libvirtd_opts="-d -l"',
match => 'libvirtd_opts=',
tag => 'libvirt-file_line',
}
Package['libvirt'] -> File_line<| path == "/etc/default/${::nova::compute::libvirt::libvirt_service_name}" |>
}
default: {

View File

@ -105,6 +105,7 @@ class nova::network(
$auto_assign_floating_ip = false,
) {
include ::nova::deps
include ::nova::params
# forward all ipv4 traffic

View File

@ -13,6 +13,7 @@ define nova::network::bridge (
$ip,
$netmask = '255.255.255.0'
) {
include ::nova::deps
case $::osfamily {

View File

@ -26,6 +26,8 @@ class nova::network::flat (
$flat_network_bridge = 'br100'
) {
include ::nova::deps
if $public_interface {
nova_config { 'DEFAULT/public_interface': value => $public_interface }
}

View File

@ -51,8 +51,13 @@ class nova::network::flatdhcp (
$dhcpbridge_flagfile = '/etc/nova/nova.conf'
) {
include ::nova::deps
if $::osfamily == 'RedHat' and $::operatingsystem != 'Fedora' {
package { 'dnsmasq-utils': ensure => present }
package { 'dnsmasq-utils':
ensure => present,
tag => ['openstack', 'nova-support-package'],
}
}
if $public_interface {

View File

@ -112,6 +112,8 @@ class nova::network::neutron (
$dhcp_domain = 'novalocal',
) {
include ::nova::deps
nova_config {
'DEFAULT/dhcp_domain': value => $dhcp_domain;
'DEFAULT/firewall_driver': value => $firewall_driver;

View File

@ -45,8 +45,13 @@ class nova::network::vlan (
$dhcpbridge_flagfile = '/etc/nova/nova.conf'
) {
include ::nova::deps
if $::osfamily == 'RedHat' and $::operatingsystem != 'Fedora' {
package { 'dnsmasq-utils': ensure => present }
package { 'dnsmasq-utils':
ensure => present,
tag => ['openstack', 'nova-support-package'],
}
}
if $public_interface {

View File

@ -27,6 +27,7 @@ class nova::objectstore(
$bind_address = '0.0.0.0'
) {
include ::nova::deps
include ::nova::params
nova::generic_service { 'objectstore':
@ -35,7 +36,6 @@ class nova::objectstore(
package_name => $::nova::params::objectstore_package_name,
service_name => $::nova::params::objectstore_service_name,
ensure_package => $ensure_package,
require => Package['nova-common'],
}
nova_config {

View File

@ -30,7 +30,11 @@ class nova::policy (
validate_hash($policies)
$policy_defaults = { 'file_path' => $policy_path }
$policy_defaults = {
'file_path' => $policy_path,
'require' => Anchor['nova::config::begin'],
'notify' => Anchor['nova::config::end'],
}
create_resources('openstacklib::policy::base', $policies, $policy_defaults)

View File

@ -127,6 +127,7 @@ class nova::quota(
$quota_max_injected_file_content_bytes = undef,
$quota_max_injected_file_path_bytes = undef
) {
include ::nova::deps
if $quota_volumes {
warning('The quota_volumes parameter is deprecated and has no effect.')

View File

@ -43,6 +43,8 @@ class nova::rabbitmq(
$port ='5672',
) {
include ::nova::deps
if ($enabled) {
if $userid == 'guest' {
$delete_guest_user = false
@ -59,10 +61,13 @@ class nova::rabbitmq(
write_permission => '.*',
read_permission => '.*',
provider => 'rabbitmqctl',
}->Anchor<| title == 'nova-start' |>
}
}
rabbitmq_vhost { $virtual_host:
provider => 'rabbitmqctl',
}
}
# Only start Nova after the queue is up
Class['nova::rabbitmq'] -> Anchor['nova::service::end']
}

View File

@ -27,6 +27,7 @@ class nova::scheduler(
$scheduler_driver = 'nova.scheduler.filter_scheduler.FilterScheduler',
) {
include ::nova::deps
include ::nova::db
include ::nova::params
@ -41,7 +42,4 @@ class nova::scheduler(
nova_config {
'DEFAULT/scheduler_driver': value => $scheduler_driver;
}
Nova_config['DEFAULT/scheduler_driver'] ~> Service <| title == 'nova-scheduler' |>
}

View File

@ -82,6 +82,8 @@ class nova::scheduler::filter (
$scheduler_use_baremetal_filters = false,
) {
include ::nova::deps
nova_config {
'DEFAULT/scheduler_host_manager': value => $scheduler_host_manager;
'DEFAULT/scheduler_max_attempts': value => $scheduler_max_attempts;

View File

@ -32,6 +32,7 @@ class nova::serialproxy(
$ensure_package = 'present'
) {
include ::nova::deps
include ::nova::params
nova_config {

View File

@ -36,6 +36,7 @@ class nova::spicehtml5proxy(
$ensure_package = 'present'
) {
include ::nova::deps
include ::nova::params
nova_config {

View File

@ -43,6 +43,7 @@ class nova::vncproxy(
$ensure_package = 'present'
) {
include ::nova::deps
include ::nova::params
# See http://nova.openstack.org/runnova/vncconsole.html for more details.
@ -58,6 +59,7 @@ class nova::vncproxy(
package { 'python-numpy':
ensure => present,
name => $::nova::params::numpy_package_name,
tag => ['openstack', 'nova-support-package'],
}
}
nova::generic_service { 'vncproxy':

View File

@ -23,6 +23,8 @@ class nova::vncproxy::common (
$vncproxy_path = undef,
) {
include ::nova::deps
$vncproxy_host_real = pick(
$vncproxy_host,
$::nova::compute::vncproxy_host,

View File

@ -31,7 +31,8 @@ describe 'nova::api' do
:ensure => 'present',
:tag => ['openstack', 'nova-package'],
)
is_expected.to contain_package('nova-api').that_notifies('Service[nova-api]')
is_expected.to contain_package('nova-api').that_requires('Anchor[nova::install::begin]')
is_expected.to contain_package('nova-api').that_notifies('Anchor[nova::install::end]')
is_expected.to_not contain_exec('validate_nova_api')
end

View File

@ -6,7 +6,7 @@ describe 'nova::client' do
it {
is_expected.to contain_package('python-novaclient').with(
:ensure => 'present',
:tag => ['openstack']
:tag => ['openstack', 'nova-support-package']
)
}
end

View File

@ -10,25 +10,34 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_class('nova::params')}
it { is_expected.to contain_package('nova-compute-kvm').with(
:ensure => 'present',
:before => 'Package[nova-compute]',
:tag => ['openstack']
) }
it {
is_expected.to contain_package('nova-compute-kvm').with(
:ensure => 'present',
:tag => ['openstack', 'nova-package']
)
is_expected.to contain_package('nova-compute-kvm').that_requires('Anchor[nova::install::begin]')
is_expected.to contain_package('nova-compute-kvm').that_notifies('Anchor[nova::install::end]')
}
it { is_expected.to contain_package('libvirt').with(
:name => 'libvirt-bin',
:ensure => 'present'
) }
it {
is_expected.to contain_package('libvirt').with(
:name => 'libvirt-bin',
:ensure => 'present'
)
is_expected.to contain_package('libvirt').that_requires('Anchor[nova::install::begin]')
is_expected.to contain_package('libvirt').that_comes_before('Anchor[nova::install::end]')
}
it { is_expected.to contain_service('libvirt').with(
:name => 'libvirt-bin',
:enable => true,
:ensure => 'running',
:provider => 'upstart',
:require => 'Package[libvirt]',
:before => ['Service[nova-compute]']
)}
it {
is_expected.to contain_service('libvirt').with(
:name => 'libvirt-bin',
:enable => true,
:ensure => 'running',
:provider => 'upstart',
)
is_expected.to contain_service('libvirt').that_requires('Anchor[nova::config::end]')
}
it { is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')}
it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('kvm')}
@ -71,13 +80,15 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_value(3600)}
it { is_expected.to contain_nova_config('libvirt/remove_unused_kernels').with_value(true)}
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_value(3600)}
it { is_expected.to contain_service('libvirt').with(
:name => 'custom_service',
:enable => true,
:ensure => 'running',
:require => 'Package[libvirt]',
:before => ['Service[nova-compute]']
)}
it {
is_expected.to contain_service('libvirt').with(
:name => 'custom_service',
:enable => true,
:ensure => 'running',
:before => ['Service[nova-compute]']
)
is_expected.to contain_service('libvirt').that_requires('Anchor[nova::config::end]')
}
end
describe 'with custom cpu_mode' do
@ -164,7 +175,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_package('libvirt-nwfilter').with(
:name => 'libvirt-daemon-config-nwfilter',
:ensure => 'present',
:before => 'Service[libvirt]',
:before => ['Service[libvirt]', 'Anchor[nova::install::end]'],
) }
it { is_expected.to contain_service('libvirt').with(
@ -172,8 +183,8 @@ describe 'nova::compute::libvirt' do
:enable => true,
:ensure => 'running',
:provider => 'init',
:require => 'Package[libvirt]',
:before => ['Service[nova-compute]']
:require => 'Anchor[nova::config::end]',
:before => ['Service[nova-compute]'],
)}
it { is_expected.to contain_service('messagebus').with(
:ensure => 'running',
@ -294,7 +305,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_package('libvirt-nwfilter').with(
:name => 'libvirt-daemon-config-nwfilter',
:ensure => 'present',
:before => 'Service[libvirt]',
:before => ['Service[libvirt]', 'Anchor[nova::install::end]'],
) }
it { is_expected.to contain_service('libvirt').with(
@ -302,7 +313,7 @@ describe 'nova::compute::libvirt' do
:enable => true,
:ensure => 'running',
:provider => nil,
:require => 'Package[libvirt]',
:require => 'Anchor[nova::config::end]',
:before => ['Service[nova-compute]']
)}

View File

@ -31,7 +31,6 @@ describe 'nova::compute' do
it { is_expected.to_not contain_package('bridge-utils').with(
:ensure => 'present',
:before => 'Nova::Generic_service[compute]'
) }
it { is_expected.to contain_package('pm-utils').with(
@ -126,8 +125,9 @@ describe 'nova::compute' do
it 'installs bridge-utils package for nova-network' do
is_expected.to contain_package('bridge-utils').with(
:ensure => 'present',
:before => 'Nova::Generic_service[compute]'
)
is_expected.to contain_package('bridge-utils').that_requires('Anchor[nova::install::begin]')
is_expected.to contain_package('bridge-utils').that_comes_before('Anchor[nova::install::end]')
end
end
@ -140,7 +140,6 @@ describe 'nova::compute' do
it 'does not install bridge-utils package for nova-network' do
is_expected.to_not contain_package('bridge-utils').with(
:ensure => 'present',
:before => 'Nova::Generic_service[compute]'
)
end

View File

@ -27,7 +27,7 @@ describe 'nova::cron::archive_deleted_rows' do
:monthday => params[:monthday],
:month => params[:month],
:weekday => params[:weekday],
:require => 'Package[nova-common]',
:require => 'Anchor[nova::dbsync::end]',
)
end
end

View File

@ -89,7 +89,7 @@ describe 'nova::db' do
is_expected.to contain_package('nova-backend-package').with(
:ensure => 'present',
:name => 'python-pymysql',
:tag => 'openstack'
:tag => ['openstack', 'nova-package'],
)
end
end
@ -103,7 +103,7 @@ describe 'nova::db' do
is_expected.to contain_package('nova-backend-package').with(
:ensure => 'present',
:name => 'python-pysqlite2',
:tag => 'openstack'
:tag => ['openstack', 'nova-package'],
)
end

View File

@ -13,7 +13,7 @@ describe 'nova' do
it 'installs packages' do
is_expected.to contain_package('python-nova').with(
:ensure => 'present',
:tag => ['openstack']
:tag => ['openstack', 'nova-package']
)
is_expected.to contain_package('nova-common').with(
:name => platform_params[:nova_common_package],
@ -22,12 +22,6 @@ describe 'nova' do
)
end
it 'creates various files and folders' do
is_expected.to contain_file('/etc/nova/nova.conf').with(
:require => 'Package[nova-common]'
)
end
it 'configures rootwrap' do
is_expected.to contain_nova_config('DEFAULT/rootwrap_config').with_value('/etc/nova/rootwrap.conf')
end

View File

@ -30,7 +30,7 @@ describe 'nova::network' do
it { is_expected.to contain_package('nova-network').with(
'name' => 'nova-network',
'ensure' => 'present',
'notify' => 'Service[nova-network]'
'notify' => ['Anchor[nova::install::end]'],
) }
describe 'with enabled as true' do

View File

@ -27,8 +27,11 @@ describe 'nova::generic_service' do
'enable' => true
)}
it { is_expected.to contain_service('nova-foo').that_requires(
['Package[nova-common]', 'Package[nova-foo]']
it { is_expected.to contain_service('nova-foo').that_subscribes_to(
'Anchor[nova::service::begin]',
)}
it { is_expected.to contain_service('nova-foo').that_notifies(
'Anchor[nova::service::end]',
)}
end
end

View File

@ -9,11 +9,12 @@ shared_examples 'generic nova service' do |service|
context 'with default parameters' do
it 'installs package and service' do
is_expected.to contain_package(service[:name]).with({
:name => service[:package_name],
:ensure => 'present',
:notify => "Service[#{service[:name]}]",
:tag => ['openstack', 'nova-package'],
:name => service[:package_name],
:ensure => 'present',
:tag => ['openstack', 'nova-package'],
})
is_expected.to contain_package(service[:name]).that_requires('Anchor[nova::install::begin]')
is_expected.to contain_package(service[:name]).that_notifies('Anchor[nova::install::end]')
is_expected.to contain_service(service[:name]).with({
:name => service[:service_name],
:ensure => 'running',
@ -21,6 +22,8 @@ shared_examples 'generic nova service' do |service|
:enable => true,
:tag => 'nova-service',
})
is_expected.to contain_service(service[:name]).that_subscribes_to('Anchor[nova::service::begin]')
is_expected.to contain_service(service[:name]).that_notifies('Anchor[nova::service::end]')
end
end
@ -34,9 +37,10 @@ shared_examples 'generic nova service' do |service|
is_expected.to contain_package(service[:name]).with({
:name => service[:package_name],
:ensure => '2012.1-2',
:notify => "Service[#{service[:name]}]",
:tag => ['openstack', 'nova-package'],
})
is_expected.to contain_package(service[:name]).that_requires('Anchor[nova::install::begin]')
is_expected.to contain_package(service[:name]).that_notifies('Anchor[nova::install::end]')
is_expected.to contain_service(service[:name]).with({
:name => service[:service_name],
:ensure => 'stopped',
@ -44,6 +48,8 @@ shared_examples 'generic nova service' do |service|
:enable => false,
:tag => 'nova-service',
})
is_expected.to contain_service(service[:name]).that_subscribes_to('Anchor[nova::service::begin]')
is_expected.to contain_service(service[:name]).that_notifies('Anchor[nova::service::end]')
end
end