diff --git a/manifests/all.pp b/manifests/all.pp index 13f00275c..494001625 100644 --- a/manifests/all.pp +++ b/manifests/all.pp @@ -1,89 +1,102 @@ # # TODO - this is currently hardcoded to be a xenserver class nova::all( - $logdir, - $verbose, - $sql_connection='mysql://root:@127.0.0.1/nova', - $network_manager, - $image_service, - $flat_network_bridge = 'xenbr0', - $glance_host, - $glance_port, - $allow_admin_api = 'true', - $rabbit_host=$::ipaddress, - $rabbit_password, - $rabbit_port, - $rabbit_userid, - $rabbit_virtual_host, - $state_path, - $lock_path, - $service_down_time, - $quota_instances, - $quota_cores, - $quota_volumes, - $quota_gigabytes, - $quota_floating_ips, - $quota_metadata_items, - $quota_max_injected_files, - $quota_max_injected_file_content_bytes, - $quota_max_injected_file_path_bytes, - $host, - $compute_type = 'libvirt', -# do kvm and libvirt have extra config options? - $xenapi_connection_url, - $xenapi_connection_username, - $xenapi_connection_password, - $xenapi_inject_image = 'false', - $db_host = 'localhost' + $db_password, + $db_name = 'nova', + $db_user = 'nova', + $db_host = 'localhost', + + $rabbit_port = undef, + $rabbit_userid = undef, + $rabbit_password = undef, + $rabbit_virtual_host = undef, + $rabbit_host = undef, + + $flat_network_bridge = 'br100', + $flat_network_bridge_ip = '11.0.0.1', + $flat_network_bridge_netmask = '255.255.255.0', + + $nova_network = '11.0.0.0', + $available_ips = '256', + + $image_service = 'nova.image.glance.GlanceImageService', + $glance_host = 'localhost', + $glance_port = '9292', + + $admin_user = 'novaadmin', + $project_name = 'nova', + + $verbose = undef ) { - class { "nova": - logdir => $logdir, - verbose => $verbose, - sql_connection => $sql_connection, - network_manager => $network_manager, - image_service => $image_service, - flat_network_bridge => $flat_network_bridge, - glance_host => $glance_host, - glance_port => $glance_port, - allow_admin_api => $allow_admin_api, - rabbit_host => $rabbit_host, - rabbit_password => $rabbit_password, - rabbit_port => $rabbit_port, - rabbit_userid => $rabbit_userid, - rabbit_virtual_host => $rabbit_virtual_host, - state_path => $state_path, - lock_path => $lock_path, - service_down_time => $service_down_time, - quota_instances => $quota_instances, - quota_cores => $quota_cores, - quota_volumes => $quota_volumes, - quota_gigabytes => $quota_gigabytes, - quota_floating_ips => $quota_floating_ips, - quota_metadata_items => $quota_metadata_items, - quota_max_injected_files => $quota_max_injected_files, - quota_max_injected_file_content_bytes => $quota_max_injected_file_content_bytes, - quota_max_injected_file_path_bytes => $quota_max_injected_file_path_bytes, + + # work around hostname bug, LP #653405 + host { $hostname: + ip => $ipaddress, + host_aliases => $fqdn, + } + class { 'nova::rabbitmq': + port => $rabbit_port, + userid => $rabbit_userid, + password => $rabbit_password, + virtual_host => $rabbit_virtual_host, + require => Host[$hostname], } - class { "nova::api": enabled => false } - class { "nova::compute": - compute_type => $compute_type, - host => $host, - xenapi_connection_url => $xenapi_connection_url, - xenapi_connection_username => $xenapi_connection_username, - xenapi_connection_password => $xenapi_connection_password, - xenapi_inject_image => $xenapi_inject_image, - enabled => false + class { "nova": + verbose => $verbose, + sql_connection => "mysql://${db_user}:${db_password}@${db_host}/${db_name}", + image_service => $image_service, + glance_host => $glance_host, + glance_port => $glance_port, + rabbit_host => $rabbit_host, + rabbit_port => $rabbit_port, + rabbit_userid => $rabbit_userid, + rabbit_password => $rabbit_password, + rabbit_virtual_host => $rabbit_virtual_host, } - class { "nova::network": enabled => false } - class { "nova::objectstore": enabled => false } - class { "nova::scheduler": enabled => false } + + class { "nova::api": enabled => true } + + class { "nova::compute": + api_server => $ipaddress, + enabled => true, + } + + class { "nova::network::flat": + enabled => true, + flat_network_bridge => $flat_network_bridge, + flat_network_bridge_ip => $flat_network_bridge_ip, + flat_network_bridge_netmask => $flat_network_bridge_netmask, + } + + class { "nova::objectstore": enabled => true } + class { "nova::scheduler": enabled => true } class { 'nova::db': # pass in db config as params - password => 'password', - name => 'nova', - user => 'nova', - host => 'localhost', + password => $db_password, + name => $db_name, + user => $db_user, + host => $db_host, } + + nova::manage::admin { $admin_user: } + nova::manage::project { $project_name: + owner => $admin_user, + } + + nova::manage::network { "${project_name}-net-${network}": + network => $nova_network, + available_ips => $available_ips, + require => Nova::Manage::Project[$project_name], + } + + # set up glance server + class { 'glance::api': + swift_store_user => 'foo_user', + swift_store_key => 'foo_pass', + } + + class { 'glance::registry': } + } diff --git a/tests/all.pp b/tests/all.pp index 43c8bdc6b..9013bda3c 100644 --- a/tests/all.pp +++ b/tests/all.pp @@ -1,4 +1,3 @@ -Nova_config { target => '/tmp/nova.config' } resources { 'nova_config': purge => true, } @@ -6,47 +5,30 @@ resources { 'nova_config': 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 { 'mysql::server': - root_password => 'password' -} +#class { 'apt': +# disable_keys => true, +# #always_apt_update => true, +# stage => 'repo-setup', +#} +#class { 'nova::repo': +# stage => 'repo-setup', +#} +class { 'mysql::server': } class { 'nova::all': - verbose => 'true', - logdir => '/var/log/nova', - 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', - glance_host => 'glance_ip_address', - glance_port => '9292', - allow_admin_api => 'true', - rabbit_host => 'rabbit_ip_address', + db_password => 'password', + db_name => 'nova', + db_user => 'nova', + db_host => 'localhost', + rabbit_password => 'rabbitpassword', rabbit_port => '5672', rabbit_userid => 'rabbit_user', rabbit_virtual_host => '/', - state_path => '/var/lib/nova', - lock_path => '/var/lock/nova', - service_down_time => '180000000', - quota_instances => '1000000', - quota_cores => '1000000', - quota_volumes => '1000000', - quota_gigabytes => '1000000', - quota_floating_ips => '1000000', - quota_metadata_items => '1000000', - quota_max_injected_files => '1000000', - quota_max_injected_file_content_bytes => '1000000', - quota_max_injected_file_path_bytes => '1000000', - host => $ipaddress, - xenapi_connection_url => 'https://', - xenapi_connection_username => 'root', - xenapi_connection_password => 'password', - xenapi_inject_image => 'false', + rabbit_host => 'localhost', + + image_service => 'nova.image.glance.GlanceImageService', + + glance_host => 'localhost', + glance_port => '9292', + }