From d3928e578daae530d88bf219f57b2449cb6419b9 Mon Sep 17 00:00:00 2001 From: Sumit Naiksatam Date: Thu, 23 Jan 2014 16:42:00 -0800 Subject: [PATCH] Remove param validation if enable_ovs_agent=false Currently the controller module assumes that the OVS agent is always configured when the neutron service is configured. This patch ensures that when OVS agent is not enabled, we do not require OVS agent specific params to be set. Change-Id: Id3e601841f2c962dbe9a142c4bdfe80b1a9fd4a7 --- manifests/controller.pp | 24 ++++++++++++----------- spec/classes/openstack_controller_spec.rb | 20 +++++++++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/manifests/controller.pp b/manifests/controller.pp index f73fd98..ace5bd4 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -504,20 +504,22 @@ class openstack::controller ( fail('neutron_db_password must be set when configuring neutron') } - if ! $bridge_interface { - fail('bridge_interface must be set when configuring neutron') - } + if $enable_ovs_agent { + if ! $bridge_interface { + fail('bridge_interface must be set when configuring neutron') + } - if ! $bridge_uplinks { - $bridge_uplinks_real = ["${external_bridge_name}:${bridge_interface}"] - } else { + if ! $bridge_uplinks { + $bridge_uplinks_real = ["${external_bridge_name}:${bridge_interface}"] + } else { $bridge_uplinks_real = $bridge_uplinks - } + } - if ! $bridge_mappings { - $bridge_mappings_real = ["${physical_network}:${external_bridge_name}"] - } else { - $bridge_mappings_real = $bridge_mappings + if ! $bridge_mappings { + $bridge_mappings_real = ["${physical_network}:${external_bridge_name}"] + } else { + $bridge_mappings_real = $bridge_mappings + } } class { 'openstack::neutron': diff --git a/spec/classes/openstack_controller_spec.rb b/spec/classes/openstack_controller_spec.rb index 8c53a22..89c3e40 100644 --- a/spec/classes/openstack_controller_spec.rb +++ b/spec/classes/openstack_controller_spec.rb @@ -814,6 +814,26 @@ describe 'openstack::controller' do }) end + context 'when ovs is not enabled' do + + let :params do + default_params.merge({ + :enable_ovs_agent => false, + :neutron => true, + :neutron_user_password => 'q_pass', + :allow_overlapping_ips => false, + :internal_address => '10.0.0.3', + :neutron_db_password => 'q_db_pass', + :metadata_shared_secret => 'secret', + :external_bridge_name => 'br-ex' + }) + end + + it 'should not fail when required ovs parameters are not set' do + should contain_class('openstack::controller') + end + end + it { should_not contain_class('nova::network') } it { should contain_class('nova::network::neutron').with(:security_group_api => 'neutron') }