|
|
bbaaef |
From f482ce2cbc0e76f1048927077021945ba0e1c216 Mon Sep 17 00:00:00 2001
|
|
|
bbaaef |
From: Russell Bryant <russell@ovn.org>
|
|
|
bbaaef |
Date: Mon, 9 Dec 2019 10:56:03 -0500
|
|
|
bbaaef |
Subject: [PATCH ovn 3/4] northd: Load config before processing nbdb contents
|
|
|
bbaaef |
|
|
|
bbaaef |
Reorder ovnnb_db_run() such that configuration parameters are loaded
|
|
|
bbaaef |
or initialized before processing the nbdb contents.
|
|
|
bbaaef |
|
|
|
bbaaef |
I found this bug because I noticed dynamic MAC addresses being
|
|
|
bbaaef |
assigned at ovn-northd startup with an empty prefix. Later, it would
|
|
|
bbaaef |
switch to allocating MAC addresses with the random prefix that was
|
|
|
bbaaef |
generated.
|
|
|
bbaaef |
|
|
|
bbaaef |
The impact of this bug is particularly bad if ovn-northd restarts in
|
|
|
bbaaef |
an existing environment. ovn-northd will check previously assigned
|
|
|
bbaaef |
dynamic addresses for validity. At startup, previously assigned MAC
|
|
|
bbaaef |
addresses will all appear invalid because they have a non-empty
|
|
|
bbaaef |
prefix, so it will reset them all. In the case of IPv6, this also
|
|
|
bbaaef |
causes the IPv6 addresses change, since OVN assigned dynamic IPv6
|
|
|
bbaaef |
addresses are based on the MAC address.
|
|
|
bbaaef |
|
|
|
bbaaef |
With ovn-kubernetes, whatever first set of addresses were assigned is
|
|
|
bbaaef |
what ends up cached on the Node object and used by the Pod. This bug
|
|
|
bbaaef |
can cause all of this to get out of sync, breaking network
|
|
|
bbaaef |
connectivity for Pods on an OVN virtual network.
|
|
|
bbaaef |
|
|
|
bbaaef |
Signed-off-by: Russell Bryant <russell@ovn.org>
|
|
|
bbaaef |
Acked-by: Numan Siddique <numans@ovn.org>
|
|
|
bbaaef |
|
|
|
bbaaef |
(cherry picked from upstream commit b441bf3a7211461552242d50e6b0c41e68d4799d)
|
|
|
bbaaef |
---
|
|
|
bbaaef |
ovn/northd/ovn-northd.c | 78 ++++++++++++++++++++++++-------------------------
|
|
|
bbaaef |
1 file changed, 39 insertions(+), 39 deletions(-)
|
|
|
bbaaef |
|
|
|
bbaaef |
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
|
|
|
bbaaef |
index 40835a0..af67f63 100644
|
|
|
bbaaef |
--- a/ovn/northd/ovn-northd.c
|
|
|
bbaaef |
+++ b/ovn/northd/ovn-northd.c
|
|
|
bbaaef |
@@ -10145,45 +10145,6 @@ ovnnb_db_run(struct northd_context *ctx,
|
|
|
bbaaef |
struct shash meter_groups = SHASH_INITIALIZER(&meter_groups);
|
|
|
bbaaef |
struct hmap lbs;
|
|
|
bbaaef |
|
|
|
bbaaef |
- build_datapaths(ctx, datapaths, lr_list);
|
|
|
bbaaef |
- build_ports(ctx, sbrec_chassis_by_name, datapaths, ports);
|
|
|
bbaaef |
- build_ovn_lbs(ctx, ports, &lbs;;
|
|
|
bbaaef |
- build_ipam(datapaths, ports);
|
|
|
bbaaef |
- build_port_group_lswitches(ctx, &port_groups, ports);
|
|
|
bbaaef |
- build_lrouter_groups(ports, lr_list);
|
|
|
bbaaef |
- build_ip_mcast(ctx, datapaths);
|
|
|
bbaaef |
- build_mcast_groups(ctx, datapaths, ports, &mcast_groups, &igmp_groups);
|
|
|
bbaaef |
- build_meter_groups(ctx, &meter_groups);
|
|
|
bbaaef |
- build_lflows(ctx, datapaths, ports, &port_groups, &mcast_groups,
|
|
|
bbaaef |
- &igmp_groups, &meter_groups, &lbs;;
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- sync_address_sets(ctx);
|
|
|
bbaaef |
- sync_port_groups(ctx);
|
|
|
bbaaef |
- sync_meters(ctx);
|
|
|
bbaaef |
- sync_dns_entries(ctx, datapaths);
|
|
|
bbaaef |
- destroy_ovn_lbs(&lbs;;
|
|
|
bbaaef |
- hmap_destroy(&lbs;;
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- struct ovn_igmp_group *igmp_group, *next_igmp_group;
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, &igmp_groups) {
|
|
|
bbaaef |
- ovn_igmp_group_destroy(&igmp_groups, igmp_group);
|
|
|
bbaaef |
- }
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- struct ovn_port_group *pg, *next_pg;
|
|
|
bbaaef |
- HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, &port_groups) {
|
|
|
bbaaef |
- ovn_port_group_destroy(&port_groups, pg);
|
|
|
bbaaef |
- }
|
|
|
bbaaef |
- hmap_destroy(&igmp_groups);
|
|
|
bbaaef |
- hmap_destroy(&mcast_groups);
|
|
|
bbaaef |
- hmap_destroy(&port_groups);
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- struct shash_node *node, *next;
|
|
|
bbaaef |
- SHASH_FOR_EACH_SAFE (node, next, &meter_groups) {
|
|
|
bbaaef |
- shash_delete(&meter_groups, node);
|
|
|
bbaaef |
- }
|
|
|
bbaaef |
- shash_destroy(&meter_groups);
|
|
|
bbaaef |
-
|
|
|
bbaaef |
/* Sync ipsec configuration.
|
|
|
bbaaef |
* Copy nb_cfg from northbound to southbound database.
|
|
|
bbaaef |
* Also set up to update sb_cfg once our southbound transaction commits. */
|
|
|
bbaaef |
@@ -10257,6 +10218,45 @@ ovnnb_db_run(struct northd_context *ctx,
|
|
|
bbaaef |
controller_event_en = smap_get_bool(&nb->options,
|
|
|
bbaaef |
"controller_event", false);
|
|
|
bbaaef |
|
|
|
bbaaef |
+ build_datapaths(ctx, datapaths, lr_list);
|
|
|
bbaaef |
+ build_ports(ctx, sbrec_chassis_by_name, datapaths, ports);
|
|
|
bbaaef |
+ build_ovn_lbs(ctx, ports, &lbs;;
|
|
|
bbaaef |
+ build_ipam(datapaths, ports);
|
|
|
bbaaef |
+ build_port_group_lswitches(ctx, &port_groups, ports);
|
|
|
bbaaef |
+ build_lrouter_groups(ports, lr_list);
|
|
|
bbaaef |
+ build_ip_mcast(ctx, datapaths);
|
|
|
bbaaef |
+ build_mcast_groups(ctx, datapaths, ports, &mcast_groups, &igmp_groups);
|
|
|
bbaaef |
+ build_meter_groups(ctx, &meter_groups);
|
|
|
bbaaef |
+ build_lflows(ctx, datapaths, ports, &port_groups, &mcast_groups,
|
|
|
bbaaef |
+ &igmp_groups, &meter_groups, &lbs;;
|
|
|
bbaaef |
+
|
|
|
bbaaef |
+ sync_address_sets(ctx);
|
|
|
bbaaef |
+ sync_port_groups(ctx);
|
|
|
bbaaef |
+ sync_meters(ctx);
|
|
|
bbaaef |
+ sync_dns_entries(ctx, datapaths);
|
|
|
bbaaef |
+ destroy_ovn_lbs(&lbs;;
|
|
|
bbaaef |
+ hmap_destroy(&lbs;;
|
|
|
bbaaef |
+
|
|
|
bbaaef |
+ struct ovn_igmp_group *igmp_group, *next_igmp_group;
|
|
|
bbaaef |
+
|
|
|
bbaaef |
+ HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, &igmp_groups) {
|
|
|
bbaaef |
+ ovn_igmp_group_destroy(&igmp_groups, igmp_group);
|
|
|
bbaaef |
+ }
|
|
|
bbaaef |
+
|
|
|
bbaaef |
+ struct ovn_port_group *pg, *next_pg;
|
|
|
bbaaef |
+ HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, &port_groups) {
|
|
|
bbaaef |
+ ovn_port_group_destroy(&port_groups, pg);
|
|
|
bbaaef |
+ }
|
|
|
bbaaef |
+ hmap_destroy(&igmp_groups);
|
|
|
bbaaef |
+ hmap_destroy(&mcast_groups);
|
|
|
bbaaef |
+ hmap_destroy(&port_groups);
|
|
|
bbaaef |
+
|
|
|
bbaaef |
+ struct shash_node *node, *next;
|
|
|
bbaaef |
+ SHASH_FOR_EACH_SAFE (node, next, &meter_groups) {
|
|
|
bbaaef |
+ shash_delete(&meter_groups, node);
|
|
|
bbaaef |
+ }
|
|
|
bbaaef |
+ shash_destroy(&meter_groups);
|
|
|
bbaaef |
+
|
|
|
bbaaef |
cleanup_macam(&macam);
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
--
|
|
|
bbaaef |
1.8.3.1
|
|
|
bbaaef |
|