compute: move neutron config in compute instead of network

Close bug #222

Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi 2014-02-11 17:30:17 +01:00
parent 31c367f6c7
commit 308ca6dc10
5 changed files with 38 additions and 140 deletions

View File

@ -74,7 +74,11 @@ class cloud::compute(
$verbose = $os_params::verbose,
$debug = $os_params::debug,
$use_syslog = $os_params::use_syslog,
$log_facility = $os_params::log_facility
$log_facility = $os_params::log_facility,
$neutron_endpoint = $os_params::ks_neutron_admin_host,
$neutron_protocol = $os_params::ks_neutron_public_proto,
$neutron_password = $os_params::ks_neutron_password,
$neutron_region_name = $os_params::region
) {
if !defined(Resource['nova_config']) {
@ -98,6 +102,13 @@ class cloud::compute(
use_syslog => $use_syslog
}
class { 'nova::network::neutron':
neutron_admin_password => $neutron_password,
neutron_admin_auth_url => "${neutron_protocol}://${neutron_endpoint}:35357/v2.0",
neutron_url => "${neutron_protocol}://${neutron_endpoint}:9696",
neutron_region_name => $neutron_region_name
}
nova_config {
'DEFAULT/resume_guests_state_on_host_boot': value => true;
}

View File

@ -1,35 +0,0 @@
#
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Network Compute node (Agent)
#
class cloud::network::compute(
$neutron_endpoint = $os_params::ks_neutron_admin_host,
$neutron_protocol = $os_params::ks_neutron_public_proto,
$neutron_password = $os_params::ks_neutron_password,
$neutron_region_name = $os_params::region
) {
include 'cloud::network'
class { 'nova::network::neutron':
neutron_admin_password => $neutron_password,
neutron_admin_auth_url => "${neutron_protocol}://${neutron_endpoint}:35357/v2.0",
neutron_url => "${neutron_protocol}://${neutron_endpoint}:9696",
neutron_region_name => $neutron_region_name
}
}

View File

@ -34,6 +34,10 @@ describe 'cloud::compute::controller' do
verbose => true,
debug => true,
use_syslog => true,
neutron_protocol => 'http',
neutron_endpoint => '10.0.0.1',
neutron_region_name => 'MyRegion',
neutron_password => 'secrete',
log_facility => 'LOG_LOCAL0' }"
end
@ -64,6 +68,15 @@ describe 'cloud::compute::controller' do
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
end
it 'configure neutron on compute node' do
should contain_class('nova::network::neutron').with(
:neutron_admin_password => 'secrete',
:neutron_admin_auth_url => 'http://10.0.0.1:35357/v2.0',
:neutron_region_name => 'MyRegion',
:neutron_url => 'http://10.0.0.1:9696'
)
end
it 'checks if Nova DB is populated' do
should contain_exec('nova_db_sync').with(
:command => '/usr/bin/nova-manage db sync',

View File

@ -34,6 +34,10 @@ describe 'cloud::compute::hypervisor' do
verbose => true,
debug => true,
use_syslog => true,
neutron_protocol => 'http',
neutron_endpoint => '10.0.0.1',
neutron_region_name => 'MyRegion',
neutron_password => 'secrete',
log_facility => 'LOG_LOCAL0' }"
end
@ -67,6 +71,15 @@ describe 'cloud::compute::hypervisor' do
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
end
it 'configure neutron on compute node' do
should contain_class('nova::network::neutron').with(
:neutron_admin_password => 'secrete',
:neutron_admin_auth_url => 'http://10.0.0.1:35357/v2.0',
:neutron_region_name => 'MyRegion',
:neutron_url => 'http://10.0.0.1:9696'
)
end
it 'checks if Nova DB is populated' do
should contain_exec('nova_db_sync').with(
:command => '/usr/bin/nova-manage db sync',

View File

@ -1,104 +0,0 @@
#
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Unit tests for cloud::network::compute class
#
require 'spec_helper'
describe 'cloud::network::compute' do
shared_examples_for 'openstack network compute' do
let :pre_condition do
"class { 'cloud::network':
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
tunnel_eth => '10.0.1.1',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
provider_bridge_mappings => ['physnet1:br-eth1'],
verbose => true,
debug => true,
use_syslog => true,
log_facility => 'LOG_LOCAL0' }"
end
let :params do
{ :neutron_protocol => 'http',
:neutron_endpoint => '10.0.0.1',
:neutron_region_name => 'MyRegion',
:neutron_password => 'secrete' }
end
it 'configure neutron common' do
should contain_class('neutron').with(
:allow_overlapping_ips => true,
:dhcp_agents_per_network => '2',
:verbose => true,
:debug => true,
:log_facility => 'LOG_LOCAL0',
:use_syslog => true,
:rabbit_user => 'neutron',
:rabbit_hosts => ['10.0.0.1'],
:rabbit_password => 'secrete',
:rabbit_virtual_host => '/',
:bind_host => '10.0.0.1',
:core_plugin => 'neutron.plugins.ml2.plugin.Ml2Plugin',
:service_plugins => ['neutron.services.loadbalancer.plugin.LoadBalancerPlugin','neutron.services.metering.metering_plugin.MeteringPlugin','neutron.services.l3_router.l3_router_plugin.L3RouterPlugin']
)
should contain_class('neutron::agents::ovs').with(
:enable_tunneling => true,
:tunnel_types => ['gre'],
:bridge_mappings => ['physnet1:br-eth1'],
:local_ip => '10.0.1.1'
)
should contain_class('neutron::plugins::ml2').with(
:type_drivers => ['gre','vlan'],
:tenant_network_types => ['gre'],
:mechanism_drivers => ['openvswitch','l2population'],
:tunnel_id_ranges => ['1:10000'],
:network_vlan_ranges => ['physnet1:1000:2999'],
:enable_security_group => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver'
)
end
it 'configure neutron on compute node' do
should contain_class('nova::network::neutron').with(
:neutron_admin_password => 'secrete',
:neutron_admin_auth_url => 'http://10.0.0.1:35357/v2.0',
:neutron_region_name => 'MyRegion',
:neutron_url => 'http://10.0.0.1:9696'
)
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'openstack network compute'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'openstack network compute'
end
end