Re: [ovs-dev] [PATCH ovn v1] northd: Load config before processing nbdb contents
On Mon, Dec 9, 2019 at 11:44 AM Numan Siddique wrote: > On Mon, Dec 9, 2019 at 11:05 AM Russell Bryant wrote: > > > > Reorder ovnnb_db_run() such that configuration parameters are loaded > > or initialized before processing the nbdb contents. > > > > I found this bug because I noticed dynamic MAC addresses being > > assigned at ovn-northd startup with an empty prefix. Later, it would > > switch to allocating MAC addresses with the random prefix that was > > generated. > > > > The impact of this bug is particularly bad if ovn-northd restarts in > > an existing environment. ovn-northd will check previously assigned > > dynamic addresses for validity. At startup, previously assigned MAC > > addresses will all appear invalid because they have a non-empty > > prefix, so it will reset them all. In the case of IPv6, this also > > causes the IPv6 addresses change, since OVN assigned dynamic IPv6 > > addresses are based on the MAC address. > > > > With ovn-kubernetes, whatever first set of addresses were assigned is > > what ends up cached on the Node object and used by the Pod. This bug > > can cause all of this to get out of sync, breaking network > > connectivity for Pods on an OVN virtual network. > > > > Signed-off-by: Russell Bryant > > Acked-by: Numan Siddique > Thanks! I pushed this to master. > > Numan > > > --- > > northd/ovn-northd.c | 78 ++--- > > 1 file changed, 39 insertions(+), 39 deletions(-) > > > > diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c > > index 33d3ff2ad..3a5cb7c91 100644 > > --- a/northd/ovn-northd.c > > +++ b/northd/ovn-northd.c > > @@ -10151,45 +10151,6 @@ ovnnb_db_run(struct northd_context *ctx, > > struct shash meter_groups = SHASH_INITIALIZER(_groups); > > struct hmap lbs; > > > > -build_datapaths(ctx, datapaths, lr_list); > > -build_ports(ctx, sbrec_chassis_by_name, datapaths, ports); > > -build_ovn_lbs(ctx, ports, ); > > -build_ipam(datapaths, ports); > > -build_port_group_lswitches(ctx, _groups, ports); > > -build_lrouter_groups(ports, lr_list); > > -build_ip_mcast(ctx, datapaths); > > -build_mcast_groups(ctx, datapaths, ports, _groups, > _groups); > > -build_meter_groups(ctx, _groups); > > -build_lflows(ctx, datapaths, ports, _groups, _groups, > > - _groups, _groups, ); > > - > > -sync_address_sets(ctx); > > -sync_port_groups(ctx); > > -sync_meters(ctx); > > -sync_dns_entries(ctx, datapaths); > > -destroy_ovn_lbs(); > > -hmap_destroy(); > > - > > -struct ovn_igmp_group *igmp_group, *next_igmp_group; > > - > > -HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, > _groups) { > > -ovn_igmp_group_destroy(_groups, igmp_group); > > -} > > - > > -struct ovn_port_group *pg, *next_pg; > > -HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, _groups) { > > -ovn_port_group_destroy(_groups, pg); > > -} > > -hmap_destroy(_groups); > > -hmap_destroy(_groups); > > -hmap_destroy(_groups); > > - > > -struct shash_node *node, *next; > > -SHASH_FOR_EACH_SAFE (node, next, _groups) { > > -shash_delete(_groups, node); > > -} > > -shash_destroy(_groups); > > - > > /* Sync ipsec configuration. > > * Copy nb_cfg from northbound to southbound database. > > * Also set up to update sb_cfg once our southbound transaction > commits. */ > > @@ -10263,6 +10224,45 @@ ovnnb_db_run(struct northd_context *ctx, > > controller_event_en = smap_get_bool(>options, > > "controller_event", false); > > > > +build_datapaths(ctx, datapaths, lr_list); > > +build_ports(ctx, sbrec_chassis_by_name, datapaths, ports); > > +build_ovn_lbs(ctx, ports, ); > > +build_ipam(datapaths, ports); > > +build_port_group_lswitches(ctx, _groups, ports); > > +build_lrouter_groups(ports, lr_list); > > +build_ip_mcast(ctx, datapaths); > > +build_mcast_groups(ctx, datapaths, ports, _groups, > _groups); > > +build_meter_groups(ctx, _groups); > > +build_lflows(ctx, datapaths, ports, _groups, _groups, > > + _groups, _groups, ); > > + > > +sync_address_sets(ctx); > > +sync_port_groups(ctx); > > +sync_meters(ctx); > > +sync_dns_entries(ctx, datapaths); > > +destroy_ovn_lbs(); > > +hmap_destroy(); > > + > > +struct ovn_igmp_group *igmp_group, *next_igmp_group; > > + > > +HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, > _groups) { > > +ovn_igmp_group_destroy(_groups, igmp_group); > > +} > > + > > +struct ovn_port_group *pg, *next_pg; > > +HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, _groups) { > > +ovn_port_group_destroy(_groups, pg); > > +} > > +hmap_destroy(_groups); > > +hmap_destroy(_groups); > > +hmap_destroy(_groups); > > + > > +struct shash_node *node, *next; > > +SHASH_FOR_EACH_SAFE (node, next, _groups) { > >
Re: [ovs-dev] [PATCH ovn v1] northd: Load config before processing nbdb contents
On Mon, Dec 9, 2019 at 11:05 AM Russell Bryant wrote: > > Reorder ovnnb_db_run() such that configuration parameters are loaded > or initialized before processing the nbdb contents. > > I found this bug because I noticed dynamic MAC addresses being > assigned at ovn-northd startup with an empty prefix. Later, it would > switch to allocating MAC addresses with the random prefix that was > generated. > > The impact of this bug is particularly bad if ovn-northd restarts in > an existing environment. ovn-northd will check previously assigned > dynamic addresses for validity. At startup, previously assigned MAC > addresses will all appear invalid because they have a non-empty > prefix, so it will reset them all. In the case of IPv6, this also > causes the IPv6 addresses change, since OVN assigned dynamic IPv6 > addresses are based on the MAC address. > > With ovn-kubernetes, whatever first set of addresses were assigned is > what ends up cached on the Node object and used by the Pod. This bug > can cause all of this to get out of sync, breaking network > connectivity for Pods on an OVN virtual network. > > Signed-off-by: Russell Bryant Acked-by: Numan Siddique Numan > --- > northd/ovn-northd.c | 78 ++--- > 1 file changed, 39 insertions(+), 39 deletions(-) > > diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c > index 33d3ff2ad..3a5cb7c91 100644 > --- a/northd/ovn-northd.c > +++ b/northd/ovn-northd.c > @@ -10151,45 +10151,6 @@ ovnnb_db_run(struct northd_context *ctx, > struct shash meter_groups = SHASH_INITIALIZER(_groups); > struct hmap lbs; > > -build_datapaths(ctx, datapaths, lr_list); > -build_ports(ctx, sbrec_chassis_by_name, datapaths, ports); > -build_ovn_lbs(ctx, ports, ); > -build_ipam(datapaths, ports); > -build_port_group_lswitches(ctx, _groups, ports); > -build_lrouter_groups(ports, lr_list); > -build_ip_mcast(ctx, datapaths); > -build_mcast_groups(ctx, datapaths, ports, _groups, _groups); > -build_meter_groups(ctx, _groups); > -build_lflows(ctx, datapaths, ports, _groups, _groups, > - _groups, _groups, ); > - > -sync_address_sets(ctx); > -sync_port_groups(ctx); > -sync_meters(ctx); > -sync_dns_entries(ctx, datapaths); > -destroy_ovn_lbs(); > -hmap_destroy(); > - > -struct ovn_igmp_group *igmp_group, *next_igmp_group; > - > -HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, > _groups) { > -ovn_igmp_group_destroy(_groups, igmp_group); > -} > - > -struct ovn_port_group *pg, *next_pg; > -HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, _groups) { > -ovn_port_group_destroy(_groups, pg); > -} > -hmap_destroy(_groups); > -hmap_destroy(_groups); > -hmap_destroy(_groups); > - > -struct shash_node *node, *next; > -SHASH_FOR_EACH_SAFE (node, next, _groups) { > -shash_delete(_groups, node); > -} > -shash_destroy(_groups); > - > /* Sync ipsec configuration. > * Copy nb_cfg from northbound to southbound database. > * Also set up to update sb_cfg once our southbound transaction commits. > */ > @@ -10263,6 +10224,45 @@ ovnnb_db_run(struct northd_context *ctx, > controller_event_en = smap_get_bool(>options, > "controller_event", false); > > +build_datapaths(ctx, datapaths, lr_list); > +build_ports(ctx, sbrec_chassis_by_name, datapaths, ports); > +build_ovn_lbs(ctx, ports, ); > +build_ipam(datapaths, ports); > +build_port_group_lswitches(ctx, _groups, ports); > +build_lrouter_groups(ports, lr_list); > +build_ip_mcast(ctx, datapaths); > +build_mcast_groups(ctx, datapaths, ports, _groups, _groups); > +build_meter_groups(ctx, _groups); > +build_lflows(ctx, datapaths, ports, _groups, _groups, > + _groups, _groups, ); > + > +sync_address_sets(ctx); > +sync_port_groups(ctx); > +sync_meters(ctx); > +sync_dns_entries(ctx, datapaths); > +destroy_ovn_lbs(); > +hmap_destroy(); > + > +struct ovn_igmp_group *igmp_group, *next_igmp_group; > + > +HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, > _groups) { > +ovn_igmp_group_destroy(_groups, igmp_group); > +} > + > +struct ovn_port_group *pg, *next_pg; > +HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, _groups) { > +ovn_port_group_destroy(_groups, pg); > +} > +hmap_destroy(_groups); > +hmap_destroy(_groups); > +hmap_destroy(_groups); > + > +struct shash_node *node, *next; > +SHASH_FOR_EACH_SAFE (node, next, _groups) { > +shash_delete(_groups, node); > +} > +shash_destroy(_groups); > + > cleanup_macam(); > } > > -- > 2.23.0 > > ___ > dev mailing list > d...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > ___ dev
[ovs-dev] [PATCH ovn v1] northd: Load config before processing nbdb contents
Reorder ovnnb_db_run() such that configuration parameters are loaded or initialized before processing the nbdb contents. I found this bug because I noticed dynamic MAC addresses being assigned at ovn-northd startup with an empty prefix. Later, it would switch to allocating MAC addresses with the random prefix that was generated. The impact of this bug is particularly bad if ovn-northd restarts in an existing environment. ovn-northd will check previously assigned dynamic addresses for validity. At startup, previously assigned MAC addresses will all appear invalid because they have a non-empty prefix, so it will reset them all. In the case of IPv6, this also causes the IPv6 addresses change, since OVN assigned dynamic IPv6 addresses are based on the MAC address. With ovn-kubernetes, whatever first set of addresses were assigned is what ends up cached on the Node object and used by the Pod. This bug can cause all of this to get out of sync, breaking network connectivity for Pods on an OVN virtual network. Signed-off-by: Russell Bryant --- northd/ovn-northd.c | 78 ++--- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 33d3ff2ad..3a5cb7c91 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -10151,45 +10151,6 @@ ovnnb_db_run(struct northd_context *ctx, struct shash meter_groups = SHASH_INITIALIZER(_groups); struct hmap lbs; -build_datapaths(ctx, datapaths, lr_list); -build_ports(ctx, sbrec_chassis_by_name, datapaths, ports); -build_ovn_lbs(ctx, ports, ); -build_ipam(datapaths, ports); -build_port_group_lswitches(ctx, _groups, ports); -build_lrouter_groups(ports, lr_list); -build_ip_mcast(ctx, datapaths); -build_mcast_groups(ctx, datapaths, ports, _groups, _groups); -build_meter_groups(ctx, _groups); -build_lflows(ctx, datapaths, ports, _groups, _groups, - _groups, _groups, ); - -sync_address_sets(ctx); -sync_port_groups(ctx); -sync_meters(ctx); -sync_dns_entries(ctx, datapaths); -destroy_ovn_lbs(); -hmap_destroy(); - -struct ovn_igmp_group *igmp_group, *next_igmp_group; - -HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, _groups) { -ovn_igmp_group_destroy(_groups, igmp_group); -} - -struct ovn_port_group *pg, *next_pg; -HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, _groups) { -ovn_port_group_destroy(_groups, pg); -} -hmap_destroy(_groups); -hmap_destroy(_groups); -hmap_destroy(_groups); - -struct shash_node *node, *next; -SHASH_FOR_EACH_SAFE (node, next, _groups) { -shash_delete(_groups, node); -} -shash_destroy(_groups); - /* Sync ipsec configuration. * Copy nb_cfg from northbound to southbound database. * Also set up to update sb_cfg once our southbound transaction commits. */ @@ -10263,6 +10224,45 @@ ovnnb_db_run(struct northd_context *ctx, controller_event_en = smap_get_bool(>options, "controller_event", false); +build_datapaths(ctx, datapaths, lr_list); +build_ports(ctx, sbrec_chassis_by_name, datapaths, ports); +build_ovn_lbs(ctx, ports, ); +build_ipam(datapaths, ports); +build_port_group_lswitches(ctx, _groups, ports); +build_lrouter_groups(ports, lr_list); +build_ip_mcast(ctx, datapaths); +build_mcast_groups(ctx, datapaths, ports, _groups, _groups); +build_meter_groups(ctx, _groups); +build_lflows(ctx, datapaths, ports, _groups, _groups, + _groups, _groups, ); + +sync_address_sets(ctx); +sync_port_groups(ctx); +sync_meters(ctx); +sync_dns_entries(ctx, datapaths); +destroy_ovn_lbs(); +hmap_destroy(); + +struct ovn_igmp_group *igmp_group, *next_igmp_group; + +HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, _groups) { +ovn_igmp_group_destroy(_groups, igmp_group); +} + +struct ovn_port_group *pg, *next_pg; +HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, _groups) { +ovn_port_group_destroy(_groups, pg); +} +hmap_destroy(_groups); +hmap_destroy(_groups); +hmap_destroy(_groups); + +struct shash_node *node, *next; +SHASH_FOR_EACH_SAFE (node, next, _groups) { +shash_delete(_groups, node); +} +shash_destroy(_groups); + cleanup_macam(); } -- 2.23.0 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev