loadbalancer: Enable priority selection

One can now define the priority of the vrrp router

close #25
This commit is contained in:
Yanis Guenane 2014-01-14 15:07:10 -05:00 committed by Sebastien Badia
parent 183b99c0d2
commit 491f7bd307
2 changed files with 7 additions and 2 deletions

View File

@ -34,6 +34,7 @@ class cloud::loadbalancer(
$spice = true,
$haproxy_auth = $os_params::haproxy_auth,
$keepalived_state = 'BACKUP',
$keepalived_priority = 50,
$keepalived_interface = $os_params::keepalived_interface,
$keepalived_ipvs = [ $os_params::openstack_vip, $os_params::mysql_vip ],
$keepalived_localhost_ip = $os_params::keepalived_localhost_ip,
@ -71,7 +72,7 @@ class cloud::loadbalancer(
virtual_ips => split(join(flatten([$keepalived_ipvs, ['']]), " dev ${keepalived_interface},"), ','),
state => $keepalived_state,
track_script => ['haproxy'],
priority => 50,
priority => $keepalived_priority,
notify_master => '"/etc/init.d/haproxy start"',
notify_backup => '"/etc/init.d/haproxy stop"',
}

View File

@ -40,6 +40,7 @@ describe 'cloud::loadbalancer' do
:spice => true,
:haproxy_auth => 'root:secrete',
:keepalived_state => 'MASTER',
:keepalived_priority => 50,
:keepalived_interface => 'eth0',
:keepalived_ipvs => ['10.0.0.1', '10.0.0.2'],
:keepalived_localhost_ip => '127.0.0.1',
@ -75,6 +76,7 @@ describe 'cloud::loadbalancer' do
it 'configure vrrp_instance with MASTER state' do
should contain_keepalived__instance('1').with({
'state' => 'MASTER',
'priority' => 50,
'notify_master' => '"/etc/init.d/haproxy start"',
'notify_backup' => '"/etc/init.d/haproxy stop"',
})
@ -102,6 +104,7 @@ describe 'cloud::loadbalancer' do
:spice => true,
:haproxy_auth => 'root:secrete',
:keepalived_state => 'BACKUP',
:keepalived_priority => 49,
:keepalived_interface => 'eth0',
:keepalived_ipvs => ['10.0.0.1', '10.0.0.2'],
:keepalived_localhost_ip => '127.0.0.1',
@ -120,7 +123,7 @@ describe 'cloud::loadbalancer' do
:ks_cinder_public_port => '8776',
:ks_neutron_public_port => '9696',
:ks_heat_public_port => '8004',
:ks_heat_cfn_public_port => '8000',
:ks_heat_cfn_public_port => '8000',
:ks_heat_cloudwatch_public_port => '8003' }
end
@ -136,6 +139,7 @@ describe 'cloud::loadbalancer' do
it 'configure vrrp_instance with BACKUP state' do
should contain_keepalived__instance('1').with({
'priority' => '49',
'notify_master' => '"/etc/init.d/haproxy start"',
'notify_backup' => '"/etc/init.d/haproxy stop"',
})