Add fedora support

This commit is a refactor of work performed by
Derek Higgins that adds fedora 16 support to these
openstack modules.

It contains the following:
- creates a params class to store all of the
data differences.
- installs all packages on all nova nodes
- introuces an anchor that is used to specify
ordering for things that need to occur before
nova is installed.
- manages libvirt package and service in the
nova::compute::libvirt class
This commit is contained in:
Dan Bode 2012-03-15 15:38:55 -07:00
parent 649f335ae4
commit e66e5ab7c4
12 changed files with 112 additions and 44 deletions

View File

@ -12,18 +12,14 @@ class nova::api($enabled=false) {
exec { "initial-db-sync":
command => "/usr/bin/nova-manage db sync",
refreshonly => true,
require => [Package["nova-common"], Nova_config['sql_connection']],
require => [Package[$::nova::params::package_names], Nova_config['sql_connection']],
}
package { "nova-api":
ensure => present,
require => Package["python-greenlet"],
notify => Exec['initial-db-sync'],
}
service { "nova-api":
name => $::nova::params::api_service_name,
ensure => $service_ensure,
enable => $enabled,
require => Package["nova-api"],
require => Package[$::nova::params::package_names],
#subscribe => File["/etc/nova/nova.conf"]
}
}

View File

@ -16,15 +16,11 @@ class nova::compute(
$service_ensure = 'stopped'
}
package { "nova-compute":
ensure => present,
require => Package['nova-common'],
}
service { "nova-compute":
name => $::nova::params::compute_service_name,
ensure => $service_ensure,
enable => $enabled,
require => Package["nova-compute"],
require => Package[$::nova::params::package_names],
before => Exec['networking-refresh'],
}

View File

@ -3,9 +3,29 @@ class nova::compute::libvirt (
$flat_network_bridge = 'br100',
$flat_network_bridge_ip,
$flat_network_bridge_netmask
) {
) inherits nova::compute{
include nova::params
package { 'libvirt':
name => $::nova::params::libvirt_package_name,
ensure => present,
}
service {"libvirt" :
name => $::nova::params::libvirt_service_name,
ensure => running,
provider => $::nova::params::special_service_provider,
require => Package['libvirt'],
}
Service['nova-compute'] {
require +> Service['libvirt'],
}
nova_config { 'libvirt_type': value => $libvirt_type }
nova_config { 'connection_type': value => 'libvirt' }
nova::network::bridge { $flat_network_bridge:
ip => $flat_network_bridge_ip,
netmask => $flat_network_bridge_netmask,

View File

@ -56,7 +56,10 @@ class nova::controller(
flat_network_bridge_netmask => $flat_network_bridge_netmask,
}
class { "nova::objectstore": enabled => true }
class { "nova::objectstore":
enabled => true,
}
class { "nova::scheduler": enabled => true }
nova::manage::admin { $admin_user: }

View File

@ -7,8 +7,8 @@ class nova::db(
$cluster_id = 'localzone'
) {
# Create the db instance before nova-common if its installed
Mysql::Db[$dbname] -> Package<| title == "nova-common" |>
# Create the db instance before openstack-nova if its installed
Mysql::Db[$dbname] -> Anchor<| title == "nova-start" |>
Mysql::Db[$dbname] ~> Exec<| title == 'initial-db-sync' |>
# now this requires storedconfigs

View File

@ -24,13 +24,23 @@ class nova(
$nodaemon = false,
$periodic_interval = '60',
$report_interval = '10'
) {
include nova::params
Nova_config<| |> {
require +> Package["nova-common"],
require +> Package[$::nova::params::package_names],
before +> File['/etc/nova/nova.conf'],
notify +> Exec['post-nova_config']
}
File {
require => Package[$::nova::params::package_names],
owner => 'nova',
group => 'nova',
}
# TODO - why is this required?
package { 'python':
ensure => present,
@ -41,10 +51,21 @@ class nova(
}
class { 'nova::utilities': }
package { ["python-nova", "nova-common", "nova-doc"]:
# 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", $::nova::params::doc_package_name]:
ensure => present,
require => Package["python-greenlet"]
}
package { $::nova::params::package_names:
ensure => present,
require => [Package["python-greenlet"], Anchor['nova-start']]
}
group { 'nova':
ensure => present
}
@ -55,13 +76,8 @@ class nova(
file { $logdir:
ensure => directory,
mode => '751',
owner => 'nova',
group => 'nova',
require => Package['nova-common'],
}
file { '/etc/nova/nova.conf':
owner => 'nova',
group => 'nova',
mode => '0640',
}
exec { "nova-db-sync":

View File

@ -9,15 +9,11 @@ class nova::network( $enabled=false ) {
$service_ensure = 'stopped'
}
package { "nova-network":
ensure => present,
require => Package["python-greenlet"]
}
service { "nova-network":
name => $::nova::params::network_service_name,
ensure => $service_ensure,
enable => $enabled,
require => Package["nova-network"],
require => Package[$::nova::params::package_names],
before => Exec['networking-refresh'],
#subscribe => File["/etc/nova/nova.conf"]
}

View File

@ -20,6 +20,9 @@ define nova::network::bridge ( $ip, $netmask = "255.255.255.0" )
}
}
'fedora' : {
}
default: { fail('nova::network_bridge currently only supports Debian and Ubuntu') }
}

View File

@ -1,5 +1,7 @@
class nova::objectstore( $enabled=false ) {
include nova::params
Exec['post-nova_config'] ~> Service['nova-objectstore']
Exec['nova-db-sync'] ~> Service['nova-objectstore']
@ -9,15 +11,11 @@ class nova::objectstore( $enabled=false ) {
$service_ensure = 'stopped'
}
package { "nova-objectstore":
ensure => present,
require => Package["python-greenlet"]
}
service { "nova-objectstore":
name => $::nova::params::objectstore_service_name,
ensure => $service_ensure,
enable => $enabled,
require => Package["nova-objectstore"],
require => Package[$::nova::params::package_names],
#subscribe => File["/etc/nova/nova.conf"]
}
}

42
manifests/params.pp Normal file
View File

@ -0,0 +1,42 @@
# these parameters need to be accessed from several locations and
# should be considered to be constant
class nova::params {
case $::osfamily {
'RedHat': {
$package_names = 'openstack-nova'
$doc_package_name = 'openstack-nova-doc'
$api_service_name = 'openstack-nova-api'
$compute_service_name = 'openstack-nova-compute'
$network_service_name = 'openstack-nova-network'
$objectstore_service_name = 'openstack-nova-objectstore'
$scheduler_service_name = 'openstack-nova-scheduler'
$libvirt_package_name = 'libvirt'
$libvirt_service_name = 'libvirtd'
$special_service_provider = 'init'
}
'Debian': {
$package_names = ['nova-common',
'nova-api',
'nova-compute',
'nova-network',
'nova-objectstore',
'nova-scheduler'
]
$doc_package_name = 'nova-doc'
$api_service_name = 'nova-api'
$compute_service_name = 'nova-compute'
$network_service_name = 'nova-network'
$objectstore_service_name = 'nova-objectstore'
$scheduler_service_name = 'nova-scheduler'
$libvirt_package_name = 'libvirt-bin'
$libvirt_service_name = 'libvirt-bin'
# some of the services need to be started form the special upstart provider
$special_service_provider = 'upstart'
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")
}
}
}

View File

@ -11,7 +11,7 @@ class nova::rabbitmq(
) {
# only configure nova after the queue is up
Class['rabbitmq::service'] -> Package<| title == 'nova-common' |>
Class['rabbitmq::service'] -> Anchor<| title == 'nova-start' |>
# work around hostname bug, LP #653405
host { $hostname:
@ -42,7 +42,7 @@ class nova::rabbitmq(
write_permission => '.*',
read_permission => '.*',
provider => 'rabbitmqctl',
}->Package<| title == 'nova-common' |>
}->Anchor<| title == 'nova-start' |>
}
class { 'rabbitmq::server':
port => $port,

View File

@ -1,5 +1,7 @@
class nova::scheduler( $enabled ) {
include nova::params
Exec['post-nova_config'] ~> Service['nova-scheduler']
Exec['nova-db-sync'] -> Service['nova-scheduler']
@ -9,15 +11,11 @@ class nova::scheduler( $enabled ) {
$service_ensure = 'stopped'
}
package { "nova-scheduler":
ensure => present,
require => Package["python-greenlet"]
}
service { "nova-scheduler":
name => $::nova::params::scheduler_service_name,
ensure => $service_ensure,
enable => $enabled,
require => Package["nova-scheduler"],
require => Package[$::nova::params::package_names],
#subscribe => File["/etc/nova/nova.conf"]
}
}