diff --git a/nova/README b/nova/README new file mode 100644 index 000000000..1bd4e1ad4 --- /dev/null +++ b/nova/README @@ -0,0 +1,4 @@ +h1. Prerequisites + +The openstack repo should be made available: +see: http://docs.openstack.org/cactus/openstack-compute/admin/content/installing-the-cloud-controller.html diff --git a/nova/manifests/all.pp b/nova/manifests/all.pp new file mode 100644 index 000000000..70d791ed9 --- /dev/null +++ b/nova/manifests/all.pp @@ -0,0 +1,46 @@ +class nova::all( + $xenapi_connection_url, + $xenapi_connection_username, + $xenapi_connection_password, + $sql_connection, + $network_manager, + $image_service, + $verbose = 'undef', + $nodaemon = 'undef', + $flat_network_bridge = 'xenbr0', + $connection_type = 'xenapi', + $xenapi_inject_image = 'false', + $rescue_timeout = '86400', + $allow_admin_api = 'true', + $xenapi_inject_image = 'false', + $use_ipv6 = 'false', + $flat_injected = 'true', + $ipv6_backend = 'account_identifier' +) { + + $novaConfFlags = { + verbose => $verbose, + nodaemon => $nodaemon, + sql_connection => $sql_connetion, + network_manager => $network_manager, + image_service => $image_service, + flat_network_bridge => $flat_network_bridge, + connection_type => $connection_type, + xenapi_connection_url => $xenapi_connection_url, + xenapi_connection_username => $xenapi_connection_username, + xenapi_connection_password => $xenapi_connection_password, + xenapi_inject_image => $xenapi_inject_image, + rescue_timeout => $resuce_timeout, + allow_admin_api => $allow_admin_api, + xenapi_inject_image => $xenapi_inject_image, + use_ipv6 => $use_ipv6, + flat_injected => $flat_injected, + ipv6_backend => $ipv6_backend + } + class { "nova": novaConfHash => $novaConfFlags } + class { "nova::api": isServiceEnabled => false } + class { "nova::compute": isServiceEnabled => false } + class { "nova::network": isServiceEnabled => false } + class { "nova::objectstore": isServiceEnabled => false } + class { "nova::scheduler": isServiceEnabled => false } +} diff --git a/nova/manifests/api.pp b/nova/manifests/api.pp new file mode 100644 index 000000000..31101c66f --- /dev/null +++ b/nova/manifests/api.pp @@ -0,0 +1,11 @@ +class nova::api($isServiceEnabled=false) inherits nova { + package { "nova-api": + ensure => present, + require => Package["python-greenlet"] + } + service { "nova-api": + ensure => $isServiceEnabled, + require => Package["nova-api"], + subscribe => File["/etc/nova/nova.conf"] + } +} diff --git a/nova/manifests/compute.pp b/nova/manifests/compute.pp new file mode 100644 index 000000000..620dbbc4e --- /dev/null +++ b/nova/manifests/compute.pp @@ -0,0 +1,13 @@ +class nova::compute( $isServiceEnabled=false ) inherits nova { + + package { "nova-compute": + ensure => present, + require => Package["python-greenlet"] + } + + service { "nova-compute": + ensure => $isServiceEnabled, + require => Package["nova-compute"], + subscribe => File["/etc/nova/nova.conf"] + } +} diff --git a/nova/manifests/db.pp b/nova/manifests/db.pp new file mode 100644 index 000000000..66fd021e2 --- /dev/null +++ b/nova/manifests/db.pp @@ -0,0 +1,15 @@ +class nova::db( + $db_pw, + $db_user = 'nova' + $db_name = 'nova', + $db_host => 'localhost' +) { + mysql::db { $db_name: + db_user => $db_user, + db_pw => $db_pw, + db_hostname => $db_hostname, + # I may want to inject some sql + # sql='', + require => Class['mysql::server'] + } +} diff --git a/nova/manifests/init.pp b/nova/manifests/init.pp index 28dabe067..23f223fce 100644 --- a/nova/manifests/init.pp +++ b/nova/manifests/init.pp @@ -1,4 +1,5 @@ -class nova { +class nova( $novaConfHash ) { + class { 'puppet': } class { [ @@ -9,12 +10,17 @@ class nova { # I may need to move python-mysqldb to elsewhere if it depends on mysql 'python', ]: + } + package { "python-greenlet": ensure => present } + + package { ["nova-common", "nova-doc"]: + ensure => present, + require => Package["python-greenlet"] } - class { 'mysql::server': - mysql_root_pw => 'password', + + file { "/etc/nova/nova.conf": + ensure => present, + content => template("nova/nova.conf.erb"), + require => Package["nova-common"] } - #mysql::db { ['nova', 'glance']:} - #class rabbitmq::server { - # - # } } diff --git a/nova/manifests/network.pp b/nova/manifests/network.pp new file mode 100644 index 000000000..26e8b98d8 --- /dev/null +++ b/nova/manifests/network.pp @@ -0,0 +1,12 @@ +class nova::network( $isServiceEnabled=false ) inherits nova { + package { "nova-network": + ensure => present, + require => Package["python-greenlet"] + } + + service { "nova-network": + ensure => $isServiceEnabled, + require => Package["nova-network"], + subscribe => File["/etc/nova/nova.conf"] + } +} diff --git a/nova/manifests/objectstore.pp b/nova/manifests/objectstore.pp new file mode 100644 index 000000000..76ec1dc4f --- /dev/null +++ b/nova/manifests/objectstore.pp @@ -0,0 +1,12 @@ +class nova::objectstore( $isServiceEnabled=false ) inherits nova { + package { "nova-objectstore": + ensure => present, + require => Package["python-greenlet"] + } + + service { "nova-objectstore": + ensure => $isServiceEnabled, + require => Package["nova-objectstore"], + subscribe => File["/etc/nova/nova.conf"] + } +} diff --git a/nova/manifests/repo.pp b/nova/manifests/repo.pp index d138493ad..4d703a0ba 100644 --- a/nova/manifests/repo.pp +++ b/nova/manifests/repo.pp @@ -1,4 +1,6 @@ class nova::repo { + # this should not be hard-coded + # eventually this will be on a real debian repo apt::source { 'openstack': location => 'http://jenkins.ohthree.com', release => 'unstable', diff --git a/nova/manifests/scheduler.pp b/nova/manifests/scheduler.pp new file mode 100644 index 000000000..15fb806cd --- /dev/null +++ b/nova/manifests/scheduler.pp @@ -0,0 +1,12 @@ +class nova::scheduler( $isServiceEnabled ) inherits nova { + package { "nova-scheduler": + ensure => present, + require => Package["python-greenlet"] + } + + service { "nova-scheduler": + ensure => $isServiceEnabled, + require => Package["nova-scheduler"], + subscribe => File["/etc/nova/nova.conf"] + } +} diff --git a/nova/templates/nova.conf.erb b/nova/templates/nova.conf.erb new file mode 100644 index 000000000..c4b0881d5 --- /dev/null +++ b/nova/templates/nova.conf.erb @@ -0,0 +1,7 @@ +<% novaConfHash.each do |key, value| -%> +<% if value != "undef" -%> +--<%= key -%>=<%= value %> +<% else -%> +--<%= key %> +<% end -%> +<% end -%> diff --git a/nova/tests/init.pp b/nova/tests/init.pp deleted file mode 100644 index c7ee89ede..000000000 --- a/nova/tests/init.pp +++ /dev/null @@ -1,7 +0,0 @@ -stage { 'repo-setup': - before => Stage['main'], -} -class { ['apt', 'nova::repo']: - stage => 'repo-setup', -} -class { 'nova': } diff --git a/nova/tests/openstack-all.pp b/nova/tests/openstack-all.pp new file mode 100644 index 000000000..feef1ecad --- /dev/null +++ b/nova/tests/openstack-all.pp @@ -0,0 +1,44 @@ +stage { 'repo-setup': + before => Stage['main'], +} +class { 'apt': + disable_keys => true, + always_apt_update => true, + stage => 'repo-setup', +} +class { 'nova::repo': + stage => 'repo-setup', +} +class { 'nova::all': + verbose => 'undef', + nodaemon => 'undef', + sql_connection => 'mysql://root:@127.0.0.1/nova', + network_manager => 'nova.network.manager.FlatManager', + image_service => 'nova.image.glance.GlanceImageService', + flat_network_bridge => 'xenbr0', + connection_type => 'xenapi', + xenapi_connection_url => 'https://', + xenapi_connection_username => 'root', + xenapi_connection_password => 'password', + xenapi_inject_image => 'false', + rescue_timeout => '86400', + allow_admin_api => 'true', + use_ipv6 => 'false', + flat_injected => 'true', + ipv6_backend => 'account_identifier', +} + +# this will probably be on its own machine +class mysql::server { + mysql_root_pw => 'foo', +} + +mysql::db { + db_user, + db_pw, + db_charset = 'utf8', + host = 'localhost', + grant='all', + sql='' +) { +} diff --git a/nova/tests/openstack-api.pp b/nova/tests/openstack-api.pp new file mode 100644 index 000000000..fbff6991d --- /dev/null +++ b/nova/tests/openstack-api.pp @@ -0,0 +1,24 @@ +class nova-api-test { + $novaConfFlags = { + verbose => 'undef', + nodaemon => 'undef', + sql_connection => 'mysql://root:@127.0.0.1/nova', + network_manager => 'nova.network.manager.FlatManager', + image_service => 'nova.image.glance.GlanceImageService', + flat_network_bridge => 'xenbr0', + connection_type => 'xenapi', + xenapi_connection_url => 'https://', + xenapi_connection_username => 'root', + xenapi_connection_password => 'password', + xenapi_inject_image => 'false', + rescue_timeout => '86400', + allow_admin_api => 'true', + xenapi_inject_image => 'false', + use_ipv6 => 'false', + flat_injected => 'true', + ipv6_backend => 'account_identifier', + } + class { "nova": novaConfHash => $novaConfFlags } + class { "nova::api": isServiceEnabled => false } +} +include nova-api-test diff --git a/nova/tests/openstack-compute.pp b/nova/tests/openstack-compute.pp new file mode 100644 index 000000000..4c8085a79 --- /dev/null +++ b/nova/tests/openstack-compute.pp @@ -0,0 +1,25 @@ +#include nova::compute +class nova-compute-test { + $novaConfFlags = { + verbose => 'undef', + nodaemon => 'undef', + sql_connection => 'mysql://root:@127.0.0.1/nova', + network_manager => 'nova.network.manager.FlatManager', + image_service => 'nova.image.glance.GlanceImageService', + flat_network_bridge => 'xenbr0', + connection_type => 'xenapi', + xenapi_connection_url => 'https://', + xenapi_connection_username => 'root', + xenapi_connection_password => 'password', + xenapi_inject_image => 'false', + rescue_timeout => '86400', + allow_admin_api => 'true', + xenapi_inject_image => 'false', + use_ipv6 => 'true', + flat_injected => 'true', + ipv6_backend => 'account_identifier', + } + class { "nova": novaConfHash => $novaConfFlags } + class { "nova::compute": isServiceEnabled => false } +} +include nova-compute-test diff --git a/nova/tests/openstack-network.pp b/nova/tests/openstack-network.pp new file mode 100644 index 000000000..924a3a3ab --- /dev/null +++ b/nova/tests/openstack-network.pp @@ -0,0 +1,24 @@ +class nova-network-test { + $novaConfFlags = { + verbose => 'undef', + nodaemon => 'undef', + sql_connection => 'mysql://root:@127.0.0.1/nova', + network_manager => 'nova.network.manager.FlatManager', + image_service => 'nova.image.glance.GlanceImageService', + flat_network_bridge => 'xenbr0', + connection_type => 'xenapi', + xenapi_connection_url => 'https://', + xenapi_connection_username => 'root', + xenapi_connection_password => 'password', + xenapi_inject_image => 'false', + rescue_timeout => '86400', + allow_admin_api => 'true', + xenapi_inject_image => 'false', + use_ipv6 => 'true', + flat_injected => 'true', + ipv6_backend => 'account_identifier', + } + class { "nova": novaConfHash => $novaConfFlags } + class { "nova::network": isServiceEnabled => false } +} +include nova-network-test diff --git a/nova/tests/openstack-objectstore.pp b/nova/tests/openstack-objectstore.pp new file mode 100644 index 000000000..079b3150d --- /dev/null +++ b/nova/tests/openstack-objectstore.pp @@ -0,0 +1,24 @@ +class nova-objectstore-test { + $novaConfFlags = { + verbose => 'undef', + nodaemon => 'undef', + sql_connection => 'mysql://root:@127.0.0.1/nova', + network_manager => 'nova.network.manager.FlatManager', + image_service => 'nova.image.glance.GlanceImageService', + flat_network_bridge => 'xenbr0', + connection_type => 'xenapi', + xenapi_connection_url => 'https://', + xenapi_connection_username => 'root', + xenapi_connection_password => 'password', + xenapi_inject_image => 'false', + rescue_timeout => '86400', + allow_admin_api => 'true', + xenapi_inject_image => 'false', + use_ipv6 => 'true', + flat_injected => 'true', + ipv6_backend => 'account_identifier', + } + class { "nova": novaConfHash => $novaConfFlags } + class { "nova::objectstore": isServiceEnabled => false } +} +include nova-objectstore-test diff --git a/nova/tests/openstack-scheduler.pp b/nova/tests/openstack-scheduler.pp new file mode 100644 index 000000000..32cdb9654 --- /dev/null +++ b/nova/tests/openstack-scheduler.pp @@ -0,0 +1,24 @@ +class nova-scheduler-test { + $novaConfFlags = { + verbose => 'undef', + nodaemon => 'undef', + sql_connection => 'mysql://root:@127.0.0.1/nova', + network_manager => 'nova.network.manager.FlatManager', + image_service => 'nova.image.glance.GlanceImageService', + flat_network_bridge => 'xenbr0', + connection_type => 'xenapi', + xenapi_connection_url => 'https://', + xenapi_connection_username => 'root', + xenapi_connection_password => 'password', + xenapi_inject_image => 'false', + rescue_timeout => '86400', + allow_admin_api => 'true', + xenapi_inject_image => 'false', + use_ipv6 => 'true', + flat_injected => 'true', + ipv6_backend => 'account_identifier', + } + class { "nova": novaConfHash => $novaConfFlags } + class { "nova::scheduler": isServiceEnabled => false } +} +include nova-scheduler-test