Merge pull request #122 from fcharlier/vlan_dhcp

Add DHCP options to nova::network::vlan
This commit is contained in:
Dan Bode 2012-06-05 17:32:27 -07:00
commit 10f8b3f9ca
4 changed files with 41 additions and 17 deletions

View File

@ -99,12 +99,18 @@ class nova::network(
'nova.network.manager.VlanManager': { 'nova.network.manager.VlanManager': {
$vlan_start = $config_overrides['vlan_start'] $vlan_start = $config_overrides['vlan_start']
$force_dhcp_release = $config_overrides['force_dhcp_release']
$dhcpbridge = $config_overrides['dhcpbridge']
$dhcpbridge_flagfile = $config_overrides['dhcpbridge_flagfile']
class { 'nova::network::vlan': class { 'nova::network::vlan':
fixed_range => $fixed_range, fixed_range => $fixed_range,
public_interface => $public_interface, public_interface => $public_interface,
vlan_interface => $private_interface, vlan_interface => $private_interface,
vlan_start => $vlan_start, vlan_start => $vlan_start,
force_dhcp_release => $force_dhcp_release,
dhcpbridge => $dhcpbridge,
dhcpbridge_flagfile => $dhcpbridge_flagfile,
} }
} }
default: { default: {

View File

@ -3,7 +3,10 @@ class nova::network::vlan (
$fixed_range, $fixed_range,
$vlan_interface, $vlan_interface,
$public_interface = undef, $public_interface = undef,
$vlan_start = '300' $vlan_start = '300',
$force_dhcp_release = true,
$dhcpbridge = '/usr/bin/nova-dhcpbridge',
$dhcpbridge_flagfile = '/etc/nova/nova.conf'
) { ) {
if $public_interface { if $public_interface {
@ -15,6 +18,9 @@ class nova::network::vlan (
'fixed_range': value => $fixed_range; 'fixed_range': value => $fixed_range;
'vlan_interface': value => $vlan_interface; 'vlan_interface': value => $vlan_interface;
'vlan_start': value => $vlan_start; 'vlan_start': value => $vlan_start;
'force_dhcp_release': value => $force_dhcp_release;
'dhcpbridge': value => $dhcpbridge;
'dhcpbridge_flagfile': value => $dhcpbridge_flagfile;
} }
} }

View File

@ -170,7 +170,10 @@ describe 'nova::network' do
it { should contain_class('nova::network::vlan').with( it { should contain_class('nova::network::vlan').with(
:fixed_range => '10.0.0.0/32', :fixed_range => '10.0.0.0/32',
:public_interface => nil, :public_interface => nil,
:vlan_interface => 'eth1' :vlan_interface => 'eth1',
:force_dhcp_release => true,
:dhcpbridge => '/usr/bin/nova-dhcpbridge',
:dhcpbridge_flagfile => '/etc/nova/nova.conf'
) } ) }
describe 'when overriding parameters' do describe 'when overriding parameters' do
let :params do let :params do

View File

@ -15,6 +15,9 @@ describe 'nova::network::vlan' do
it { should contain_nova_config('fixed_range').with_value('10.0.0.0/32') } it { should contain_nova_config('fixed_range').with_value('10.0.0.0/32') }
it { should contain_nova_config('vlan_start').with_value('300') } it { should contain_nova_config('vlan_start').with_value('300') }
it { should contain_nova_config('vlan_interface').with_value('eth1') } it { should contain_nova_config('vlan_interface').with_value('eth1') }
it { should contain_nova_config('force_dhcp_release').with_value('true') }
it { should contain_nova_config('dhcpbridge').with_value('/usr/bin/nova-dhcpbridge') }
it { should contain_nova_config('dhcpbridge_flagfile').with_value('/etc/nova/nova.conf') }
end end
@ -25,7 +28,10 @@ describe 'nova::network::vlan' do
:vlan_interface => 'eth1', :vlan_interface => 'eth1',
:fixed_range => '10.0.0.0/32', :fixed_range => '10.0.0.0/32',
:public_interface => 'eth0', :public_interface => 'eth0',
:vlan_start => '100' :vlan_start => '100',
:force_dhcp_release => false,
:dhcpbridge => '/usr/bin/dhcpbridge',
:dhcpbridge_flagfile => '/etc/nova/nova-dhcp.conf'
} }
end end
@ -34,5 +40,8 @@ describe 'nova::network::vlan' do
it { should contain_nova_config('fixed_range').with_value('10.0.0.0/32') } it { should contain_nova_config('fixed_range').with_value('10.0.0.0/32') }
it { should contain_nova_config('vlan_start').with_value('100') } it { should contain_nova_config('vlan_start').with_value('100') }
it { should contain_nova_config('vlan_interface').with_value('eth1') } it { should contain_nova_config('vlan_interface').with_value('eth1') }
it { should contain_nova_config('force_dhcp_release').with_value('false') }
it { should contain_nova_config('dhcpbridge').with_value('/usr/bin/dhcpbridge') }
it { should contain_nova_config('dhcpbridge_flagfile').with_value('/etc/nova/nova-dhcp.conf') }
end end
end end