Skip to content

Commit

Permalink
northd: fix lb_action when there are no active backends for lb health…
Browse files Browse the repository at this point in the history
…_check

Fix the following warning reported by ovn-controller when there are no
active backends for lb health_check and selection_fields have been
configured for hash computation

flow|WARN|error parsing actions "drop; hash_fields="ip_dst,ip_src,tcp_dst,tcp_src");":
Syntax error at `hash_fields' expecting end of input.

Fixes: 5af304e ("Support selection fields in load balancer.")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
LorenzoBianconi authored and ovsrobot committed Nov 3, 2020
1 parent b38e10f commit 513a3b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion northd/ovn-northd.c
Expand Up @@ -3598,6 +3598,8 @@ static void build_lb_vip_ct_lb_actions(struct lb_vip *lb_vip,
struct ds *action,
char *selection_fields)
{
bool skip_hash_fields = false;

if (lb_vip->health_check) {
ds_put_cstr(action, "ct_lb(backends=");

Expand All @@ -3616,6 +3618,7 @@ static void build_lb_vip_ct_lb_actions(struct lb_vip *lb_vip,
}

if (!n_active_backends) {
skip_hash_fields = true;
ds_clear(action);
ds_put_cstr(action, "drop;");
} else {
Expand All @@ -3626,7 +3629,7 @@ static void build_lb_vip_ct_lb_actions(struct lb_vip *lb_vip,
ds_put_format(action, "ct_lb(backends=%s);", lb_vip->backend_ips);
}

if (selection_fields && selection_fields[0]) {
if (!skip_hash_fields && selection_fields && selection_fields[0]) {
ds_chomp(action, ';');
ds_chomp(action, ')');
ds_put_format(action, "; hash_fields=\"%s\");", selection_fields);
Expand Down

0 comments on commit 513a3b8

Please sign in to comment.