HAproxy: change Spice options

- Add "option" parameter to binding function
- Use this new parameter for adding options to Spice binding
  configuration:
  - Use "leastconn" mode instead of "roundrobin"
  - Use a 2 hours timeout to avoid Spice disconnection after some idle
    activity both on client & server sides.

Closes-bug #463
Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi
2014-05-14 19:16:39 -04:00
parent 1d60d73dfd
commit 1ef7c19d76
3 changed files with 20 additions and 5 deletions

View File

@@ -309,9 +309,14 @@ class cloud::loadbalancer(
port => $ks_metadata_public_port; port => $ks_metadata_public_port;
} }
cloud::loadbalancer::binding { 'spice_cluster': cloud::loadbalancer::binding { 'spice_cluster':
ip => $spice, ip => $spice,
port => $spice_port, port => $spice_port,
httpchk => 'httpchk GET /'; options => {
'balance' => 'leastconn',
'timeout server' => '120m',
'timeout client' => '120m',
},
httpchk => 'httpchk GET /';
} }
cloud::loadbalancer::binding { 'glance_api_cluster': cloud::loadbalancer::binding { 'glance_api_cluster':
ip => $glance_api, ip => $glance_api,

View File

@@ -17,7 +17,8 @@
define cloud::loadbalancer::binding ( define cloud::loadbalancer::binding (
$ip, $ip,
$port, $port,
$httpchk = undef $httpchk = undef,
$options = undef
){ ){
include cloud::loadbalancer include cloud::loadbalancer
@@ -56,6 +57,7 @@ define cloud::loadbalancer::binding (
cloud::loadbalancer::listen_http { $name : cloud::loadbalancer::listen_http { $name :
ports => $port, ports => $port,
httpchk => $httpchk, httpchk => $httpchk,
options => $options,
listen_ip => $listen_ip_real; listen_ip => $listen_ip_real;
} }
} }

View File

@@ -182,7 +182,15 @@ describe 'cloud::loadbalancer' do
context 'configure OpenStack binding on public network only' do context 'configure OpenStack binding on public network only' do
it { should contain_haproxy__listen('spice_cluster').with( it { should contain_haproxy__listen('spice_cluster').with(
:ipaddress => [params[:vip_public_ip]], :ipaddress => [params[:vip_public_ip]],
:ports => '6082' :ports => '6082',
:options => {
'mode' => 'http',
'option' => ['tcpka','tcplog','httpchk GET /'],
'http-check' => 'expect ! rstatus ^5',
'balance' => 'leastconn',
'timeout server' => '120m',
'timeout client' => '120m'
}
)} )}
end end