Skip to content

Commit

Permalink
Add fedora support
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Dan Bode committed Mar 15, 2012
1 parent 649f335 commit e66e5ab
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 44 deletions.
10 changes: 3 additions & 7 deletions manifests/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@
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"]
}
}
8 changes: 2 additions & 6 deletions manifests/compute.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@
$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'],
}

Expand Down
22 changes: 21 additions & 1 deletion manifests/compute/libvirt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,29 @@
$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,
Expand Down
5 changes: 4 additions & 1 deletion manifests/controller.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
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: }
Expand Down
4 changes: 2 additions & 2 deletions manifests/db.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
$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
Expand Down
30 changes: 23 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,23 @@
$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,
Expand All @@ -41,10 +51,21 @@
}

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
}
Expand All @@ -55,13 +76,8 @@
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":
Expand Down
8 changes: 2 additions & 6 deletions manifests/network.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@
$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"]
}
Expand Down
3 changes: 3 additions & 0 deletions manifests/network/bridge.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
}
}

'fedora' : {
}

default: { fail('nova::network_bridge currently only supports Debian and Ubuntu') }

}
Expand Down
10 changes: 4 additions & 6 deletions manifests/objectstore.pp
Original file line number Diff line number Diff line change
@@ -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']

Expand All @@ -9,15 +11,11 @@
$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 changes: 42 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -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")
}
}

}
4 changes: 2 additions & 2 deletions manifests/rabbitmq.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
) {

# 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:
Expand Down Expand Up @@ -42,7 +42,7 @@
write_permission => '.*',
read_permission => '.*',
provider => 'rabbitmqctl',
}->Package<| title == 'nova-common' |>
}->Anchor<| title == 'nova-start' |>
}
class { 'rabbitmq::server':
port => $port,
Expand Down
10 changes: 4 additions & 6 deletions manifests/scheduler.pp
Original file line number Diff line number Diff line change
@@ -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']

Expand All @@ -9,15 +11,11 @@
$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"]
}
}

0 comments on commit e66e5ab

Please sign in to comment.