Recent patch [see Fixes] added a column 'local' to the sb Service_Monitor table.
However, an upgrade from e.g. 24.03 would cause service monitors to stop
working as
the new local would remain false for existing service monitors (i.e. those
monitors would be considered as remote).
This patch changes the new column to 'remote', so that the default does not
change.
Fixes: 840e441f6f5d ("northd, controller: Add support for remote LB health
checks.")
Signed-off-by: Xavier Simonart <[email protected]>
---
controller/pinctrl.c | 2 +-
ic/ovn-ic.c | 36 ++++++++++++++++++------------------
northd/lb.c | 2 +-
northd/lb.h | 4 ++--
northd/northd.c | 12 ++++++------
ovn-sb.ovsschema | 6 +++---
ovn-sb.xml | 4 ++--
tests/ovn-ic.at | 14 +++++++-------
tests/ovn-northd.at | 4 ++--
9 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/controller/pinctrl.c b/controller/pinctrl.c
index 400cb59e4..a722da59e 100644
--- a/controller/pinctrl.c
+++ b/controller/pinctrl.c
@@ -7034,7 +7034,7 @@ sync_svc_monitors(struct ovsdb_idl_txn *ovnsb_idl_txn,
const struct sbrec_port_binding *pb
= lport_lookup_by_name(sbrec_port_binding_by_name,
sb_svc_mon->logical_port);
- if (!pb || !sb_svc_mon->local) {
+ if (!pb || sb_svc_mon->remote) {
continue;
}
diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index ac8eb200f..d1a59d372 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -70,9 +70,9 @@ struct ic_context {
struct ovsdb_idl_index *nbrec_port_by_name;
struct ovsdb_idl_index *sbrec_chassis_by_name;
struct ovsdb_idl_index *sbrec_port_binding_by_name;
- struct ovsdb_idl_index *sbrec_service_monitor_by_local_type;
+ struct ovsdb_idl_index *sbrec_service_monitor_by_remote_type;
struct ovsdb_idl_index *sbrec_service_monitor_by_ic_learned;
- struct ovsdb_idl_index *sbrec_service_monitor_by_local_type_logical_port;
+ struct ovsdb_idl_index *sbrec_service_monitor_by_remote_type_logical_port;
struct ovsdb_idl_index *icnbrec_transit_switch_by_name;
struct ovsdb_idl_index *icsbrec_port_binding_by_az;
struct ovsdb_idl_index *icsbrec_port_binding_by_ts;
@@ -2322,13 +2322,13 @@ create_pushed_svcs_mon(struct ic_context *ctx,
{
struct sbrec_service_monitor *key =
sbrec_service_monitor_index_init_row(
- ctx->sbrec_service_monitor_by_local_type);
+ ctx->sbrec_service_monitor_by_remote_type);
- sbrec_service_monitor_index_set_local(key, false);
+ sbrec_service_monitor_index_set_remote(key, true);
const struct sbrec_service_monitor *sb_rec;
SBREC_SERVICE_MONITOR_FOR_EACH_EQUAL (sb_rec, key,
- ctx->sbrec_service_monitor_by_local_type) {
+ ctx->sbrec_service_monitor_by_remote_type) {
const char *target_az_name = smap_get(&sb_rec->options,
"az-name");
if (!target_az_name) {
@@ -2430,14 +2430,14 @@ lookup_sb_svc_rec(struct ic_context *ctx,
svc_mon->db_rec.ic_rec;
struct sbrec_service_monitor *key =
sbrec_service_monitor_index_init_row(
- ctx->sbrec_service_monitor_by_local_type_logical_port);
+ ctx->sbrec_service_monitor_by_remote_type_logical_port);
- sbrec_service_monitor_index_set_local(key, true);
+ sbrec_service_monitor_index_set_remote(key, false);
sbrec_service_monitor_index_set_logical_port(key, db_rec->logical_port);
const struct sbrec_service_monitor *sb_rec;
SBREC_SERVICE_MONITOR_FOR_EACH_EQUAL (sb_rec, key,
- ctx->sbrec_service_monitor_by_local_type_logical_port) {
+ ctx->sbrec_service_monitor_by_remote_type_logical_port) {
if (db_rec->port == sb_rec->port &&
!strcmp(db_rec->ip, sb_rec->ip) &&
!strcmp(db_rec->src_ip, sb_rec->src_ip) &&
@@ -2590,7 +2590,7 @@ sync_service_monitor(struct ic_context *ctx)
db_rec->protocol);
sbrec_service_monitor_set_logical_port(sb_rec,
db_rec->logical_port);
- sbrec_service_monitor_set_local(sb_rec, true);
+ sbrec_service_monitor_set_remote(sb_rec, false);
sbrec_service_monitor_set_ic_learned(sb_rec, true);
}
@@ -3059,7 +3059,7 @@ main(int argc, char *argv[])
ovsdb_idl_add_column(ovnsb_idl_loop.idl,
&sbrec_service_monitor_col_src_mac);
ovsdb_idl_add_column(ovnsb_idl_loop.idl,
- &sbrec_service_monitor_col_local);
+ &sbrec_service_monitor_col_remote);
ovsdb_idl_add_column(ovnsb_idl_loop.idl,
&sbrec_service_monitor_col_ic_learned);
ovsdb_idl_add_column(ovnsb_idl_loop.idl,
@@ -3084,17 +3084,17 @@ main(int argc, char *argv[])
= ovsdb_idl_index_create1(ovnsb_idl_loop.idl,
&sbrec_chassis_col_name);
- struct ovsdb_idl_index *sbrec_service_monitor_by_local_type
+ struct ovsdb_idl_index *sbrec_service_monitor_by_remote_type
= ovsdb_idl_index_create1(ovnsb_idl_loop.idl,
- &sbrec_service_monitor_col_local);
+ &sbrec_service_monitor_col_remote);
struct ovsdb_idl_index *sbrec_service_monitor_by_ic_learned
= ovsdb_idl_index_create1(ovnsb_idl_loop.idl,
&sbrec_service_monitor_col_ic_learned);
- struct ovsdb_idl_index *sbrec_service_monitor_by_local_type_logical_port
+ struct ovsdb_idl_index *sbrec_service_monitor_by_remote_type_logical_port
= ovsdb_idl_index_create2(ovnsb_idl_loop.idl,
- &sbrec_service_monitor_col_local,
+ &sbrec_service_monitor_col_remote,
&sbrec_service_monitor_col_logical_port);
struct ovsdb_idl_index *icnbrec_transit_switch_by_name
@@ -3191,12 +3191,12 @@ main(int argc, char *argv[])
.nbrec_port_by_name = nbrec_port_by_name,
.sbrec_port_binding_by_name = sbrec_port_binding_by_name,
.sbrec_chassis_by_name = sbrec_chassis_by_name,
- .sbrec_service_monitor_by_local_type =
- sbrec_service_monitor_by_local_type,
+ .sbrec_service_monitor_by_remote_type =
+ sbrec_service_monitor_by_remote_type,
.sbrec_service_monitor_by_ic_learned =
sbrec_service_monitor_by_ic_learned,
- .sbrec_service_monitor_by_local_type_logical_port =
- sbrec_service_monitor_by_local_type_logical_port,
+ .sbrec_service_monitor_by_remote_type_logical_port =
+ sbrec_service_monitor_by_remote_type_logical_port,
.icnbrec_transit_switch_by_name =
icnbrec_transit_switch_by_name,
.icsbrec_port_binding_by_az = icsbrec_port_binding_by_az,
diff --git a/northd/lb.c b/northd/lb.c
index 30726cd27..495a5cdd8 100644
--- a/northd/lb.c
+++ b/northd/lb.c
@@ -195,7 +195,7 @@ ovn_lb_vip_backends_health_check_init(const struct
ovn_northd_lb *lb,
backend_nb->logical_port = xstrdup(port_name);
backend_nb->svc_mon_src_ip = svc_mon_src_ip;
backend_nb->az_name = is_remote ? xstrdup(az_name) : NULL;
- backend_nb->local_backend = !is_remote;
+ backend_nb->remote_backend = is_remote;
}
free(port_name);
}
diff --git a/northd/lb.h b/northd/lb.h
index a0e560204..4c45e0283 100644
--- a/northd/lb.h
+++ b/northd/lb.h
@@ -88,8 +88,8 @@ struct ovn_northd_lb_vip {
struct ovn_northd_lb_backend {
bool health_check;
- /* Set to true if port locates in local AZ. */
- bool local_backend;
+ /* Set to true if port does not locate in local AZ. */
+ bool remote_backend;
/* Logical port to which the ip belong to. */
char *logical_port;
/* Source IP address to be used for service monitoring. */
diff --git a/northd/northd.c b/northd/northd.c
index b604d8412..36ab380ac 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -2990,7 +2990,7 @@ create_or_get_service_mon(struct ovsdb_idl_txn *ovnsb_txn,
struct hmap *ic_learned_svc_monitors_map,
const char *ip, const char *logical_port,
uint16_t service_port, const char *protocol,
- const char *chassis_name, bool local_backend)
+ const char *chassis_name, bool remote_backend)
{
struct service_monitor_info *mon_info =
get_service_mon(local_svc_monitors_map,
@@ -3025,7 +3025,7 @@ create_or_get_service_mon(struct ovsdb_idl_txn *ovnsb_txn,
sbrec_service_monitor_set_port(sbrec_mon, service_port);
sbrec_service_monitor_set_logical_port(sbrec_mon, logical_port);
sbrec_service_monitor_set_protocol(sbrec_mon, protocol);
- sbrec_service_monitor_set_local(sbrec_mon, local_backend);
+ sbrec_service_monitor_set_remote(sbrec_mon, remote_backend);
sbrec_service_monitor_set_ic_learned(sbrec_mon, false);
if (chassis_name) {
sbrec_service_monitor_set_chassis_name(sbrec_mon, chassis_name);
@@ -3068,7 +3068,7 @@ ovn_lb_svc_create(struct ovsdb_idl_txn *ovnsb_txn,
struct ovn_port *op = ovn_port_find(ls_ports,
backend_nb->logical_port);
- if (backend_nb->local_backend &&
+ if (!backend_nb->remote_backend &&
(!op || !lsp_is_enabled(op->nbsp))) {
continue;
}
@@ -3079,7 +3079,7 @@ ovn_lb_svc_create(struct ovsdb_idl_txn *ovnsb_txn,
}
const char *chassis_name = NULL;
- if (backend_nb->local_backend && op->sb->chassis) {
+ if (!backend_nb->remote_backend && op->sb->chassis) {
chassis_name = op->sb->chassis->name;
}
@@ -3092,7 +3092,7 @@ ovn_lb_svc_create(struct ovsdb_idl_txn *ovnsb_txn,
backend->port,
protocol,
chassis_name,
- backend_nb->local_backend);
+ backend_nb->remote_backend);
ovs_assert(mon_info);
set_service_mon_options(mon_info->sbrec_mon,
&lb_vip_nb->lb_health_check->options,
@@ -3113,7 +3113,7 @@ ovn_lb_svc_create(struct ovsdb_idl_txn *ovnsb_txn,
backend_nb->svc_mon_src_ip);
}
- if (backend_nb->local_backend &&
+ if (!backend_nb->remote_backend &&
(!op->sb->n_up || !op->sb->up[0])
&& mon_info->sbrec_mon->status
&& !strcmp(mon_info->sbrec_mon->status, "online")) {
diff --git a/ovn-sb.ovsschema b/ovn-sb.ovsschema
index 8a890b27b..99d65d2e8 100644
--- a/ovn-sb.ovsschema
+++ b/ovn-sb.ovsschema
@@ -1,7 +1,7 @@
{
"name": "OVN_Southbound",
- "version": "21.4.0",
- "cksum": "317670898 35437",
+ "version": "21.5.0",
+ "cksum": "2304881328 35438",
"tables": {
"SB_Global": {
"columns": {
@@ -530,7 +530,7 @@
"enum": ["set", ["online", "offline", "error"]]},
"min": 0, "max": 1}},
"ic_learned": {"type": "boolean"},
- "local": {"type": "boolean"},
+ "remote": {"type": "boolean"},
"options": {
"type": {"key": "string", "value": "string",
"min": 0, "max": "unlimited"}},
diff --git a/ovn-sb.xml b/ovn-sb.xml
index ab647f522..c5e86a87e 100644
--- a/ovn-sb.xml
+++ b/ovn-sb.xml
@@ -5033,8 +5033,8 @@ tcp.flags = RST;
The name of the chassis where the logical port is bound.
</column>
- <column name="local">
- Set to true if backend locates on local ovn deployment.
+ <column name="remote">
+ Set to true if backend locates on remote ovn deployment.
</column>
<column name="ic_learned">
diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
index 74ea3bad2..368b6701b 100644
--- a/tests/ovn-ic.at
+++ b/tests/ovn-ic.at
@@ -3723,21 +3723,21 @@ check_column 10880 sb:Service_Monitor port
logical_port=lport3_az2
check_column tcp sb:Service_Monitor protocol logical_port=lport3_az2
check_column "3.3.3.9" sb:Service_Monitor src_ip logical_port=lport3_az2
check_column false sb:Service_Monitor ic_learned logical_port=lport3_az2
-check_column false sb:Service_Monitor local logical_port=lport3_az2
+check_column true sb:Service_Monitor remote logical_port=lport3_az2
check_column "1.1.1.1" sb:Service_Monitor ip logical_port=lport1_az1
check_column 10880 sb:Service_Monitor port logical_port=lport1_az1
check_column tcp sb:Service_Monitor protocol logical_port=lport1_az1
check_column "1.1.1.9" sb:Service_Monitor src_ip logical_port=lport1_az1
check_column false sb:Service_Monitor ic_learned logical_port=lport1_az1
-check_column true sb:Service_Monitor local logical_port=lport1_az1
+check_column false sb:Service_Monitor remote logical_port=lport1_az1
check_column "5.5.5.1" sb:Service_Monitor ip logical_port=lport5_az3
check_column 10880 sb:Service_Monitor port logical_port=lport5_az3
check_column tcp sb:Service_Monitor protocol logical_port=lport5_az3
check_column "5.5.5.9" sb:Service_Monitor src_ip logical_port=lport5_az3
check_column false sb:Service_Monitor ic_learned logical_port=lport5_az3
-check_column false sb:Service_Monitor local logical_port=lport5_az3
+check_column true sb:Service_Monitor remote logical_port=lport5_az3
check_row_count ic-sb:Service_Monitor 2
@@ -3786,11 +3786,11 @@ check_row_count sb:Service_Monitor 3
# Check that the local backend, which intersects with the one created in
another availability zone, remains local
check_column false sb:Service_Monitor ic_learned logical_port=lport1_az1
-check_column true sb:Service_Monitor local logical_port=lport1_az1
+check_column false sb:Service_Monitor remote logical_port=lport1_az1
ovn_as az2
check_column false sb:Service_Monitor ic_learned logical_port=lport1_az1
-check_column false sb:Service_Monitor local logical_port=lport1_az1
+check_column true sb:Service_Monitor remote logical_port=lport1_az1
# Сheck that all remote and local service monitors have been created.
check_column az2 ic-sb:Service_Monitor target_availability_zone
logical_port=lport3_az2
@@ -3823,7 +3823,7 @@ check_column 10880 sb:Service_Monitor port
logical_port=lport5_az3
check_column tcp sb:Service_Monitor protocol logical_port=lport5_az3
check_column "5.5.5.9" sb:Service_Monitor src_ip logical_port=lport5_az3
check_column true sb:Service_Monitor ic_learned logical_port=lport5_az3
-check_column true sb:Service_Monitor local logical_port=lport5_az3
+check_column false sb:Service_Monitor remote logical_port=lport5_az3
# Check that logical flows are created for ic_learned service monitors when we
have no load balancers.
AT_CHECK([ovn-sbctl lflow-list az3_ls1 | grep 'ls_in_arp_rsp' |
ovn_strip_lflows], [0], [dnl
@@ -3849,7 +3849,7 @@ check ovn-nbctl set load_balancer az2_lb2
ip_port_mappings:6.6.6.1=lport6_az3:6.
ovn_as az1
check_row_count sb:Service_Monitor 4
check_column true sb:Service_Monitor ic_learned logical_port=lport2_az1
-check_column true sb:Service_Monitor local logical_port=lport2_az1
+check_column false sb:Service_Monitor remote logical_port=lport2_az1
ovn_as az2
check_row_count sb:Service_Monitor 4
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 3d27f10cd..208e4b6e5 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -17895,7 +17895,7 @@ check_column 10880 sb:Service_Monitor port
logical_port=lport1
check_column tcp sb:Service_Monitor protocol logical_port=lport1
check_column "192.168.0.99" sb:Service_Monitor src_ip logical_port=lport1
check_column false sb:Service_Monitor ic_learned logical_port=lport1
-check_column true sb:Service_Monitor local logical_port=lport1
+check_column false sb:Service_Monitor remote logical_port=lport1
# Empty src_ip.
check ovn-nbctl clear load_balancer lb1_ipv4 ip_port_mappings
@@ -17925,7 +17925,7 @@ check_column 10880 sb:Service_Monitor port
logical_port=lport1
check_column tcp sb:Service_Monitor protocol logical_port=lport1
check_column "192.168.0.99" sb:Service_Monitor src_ip logical_port=lport1
check_column false sb:Service_Monitor ic_learned logical_port=lport1
-check_column false sb:Service_Monitor local logical_port=lport1
+check_column true sb:Service_Monitor remote logical_port=lport1
uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Service_Monitor
logical_port=lport1)
--
2.47.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev