From 1e2a93a4a5f7ca1f34bf85c9551839ee732a079d Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Thu, 5 Jul 2018 21:34:19 -0700 Subject: [PATCH] Fix cookie session persistence in namespace driver The old namespace driver was using, the long deprecated, appsession option for APP_COOKIE session persistence. This fails on HAProxy 1.6 and later. This patch moves that over to the modern stick table method. Change-Id: I834958f711525c08fad12e280abc308820b20521 Story: 1640882 Task: 5321 --- neutron_lbaas/drivers/haproxy/templates/haproxy_proxies.j2 | 4 +++- neutron_lbaas/tests/unit/drivers/haproxy/test_jinja_cfg.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/neutron_lbaas/drivers/haproxy/templates/haproxy_proxies.j2 b/neutron_lbaas/drivers/haproxy/templates/haproxy_proxies.j2 index ae00b46d0..1b4b2a5c2 100644 --- a/neutron_lbaas/drivers/haproxy/templates/haproxy_proxies.j2 +++ b/neutron_lbaas/drivers/haproxy/templates/haproxy_proxies.j2 @@ -69,7 +69,9 @@ backend {{ pool.id }} {% elif pool.session_persistence.type == constants.SESSION_PERSISTENCE_HTTP_COOKIE %} cookie SRV insert indirect nocache {% elif pool.session_persistence.type == constants.SESSION_PERSISTENCE_APP_COOKIE and pool.session_persistence.cookie_name %} - appsession {{ pool.session_persistence.cookie_name }} len 56 timeout 3h + stick-table type string len 64 size 10k + stick store-response res.cook({{ pool.session_persistence.cookie_name }}) + stick match req.cook({{ pool.session_persistence.cookie_name }}) {% endif %} {% endif %} {% if pool.health_monitor %} diff --git a/neutron_lbaas/tests/unit/drivers/haproxy/test_jinja_cfg.py b/neutron_lbaas/tests/unit/drivers/haproxy/test_jinja_cfg.py index 369f4cead..b995779e7 100644 --- a/neutron_lbaas/tests/unit/drivers/haproxy/test_jinja_cfg.py +++ b/neutron_lbaas/tests/unit/drivers/haproxy/test_jinja_cfg.py @@ -283,7 +283,9 @@ class TestHaproxyCfg(base.BaseTestCase): be = ("backend sample_pool_id_1\n" " mode http\n" " balance roundrobin\n" - " appsession APP_COOKIE len 56 timeout 3h\n" + " stick-table type string len 64 size 10k\n" + " stick store-response res.cook(APP_COOKIE)\n" + " stick match req.cook(APP_COOKIE)\n" " timeout check 31s\n" " option httpchk GET /index.html\n" " http-check expect rstatus %s\n"