Message ID | 20161218081834.18541-15-blp@ovn.org |
---|---|
State | Accepted |
Headers | show |
On Sun, Dec 18, 2016 at 12:18 AM, Ben Pfaff <blp@ovn.org> wrote: > This sset has always just contained the names of logical ports that are > local to the current hypervisor, but the name 'all_lports' implied that it > contained the name of every logical port. > > Signed-off-by: Ben Pfaff <blp@ovn.org> > Acked-by: Mickey Spiegel <mickeys.dev@gmail.com> --- > ovn/controller/binding.c | 25 +++++++++++++------------ > ovn/controller/ovn-controller.c | 14 ++++++++++---- > 2 files changed, 23 insertions(+), 16 deletions(-) > > diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c > index 5f71a48..fbdcf67 100644 > --- a/ovn/controller/binding.c > +++ b/ovn/controller/binding.c > @@ -67,7 +67,7 @@ binding_register_ovs_idl(struct ovsdb_idl *ovs_idl) > static void > get_local_iface_ids(const struct ovsrec_bridge *br_int, > struct shash *lport_to_iface, > - struct sset *all_lports, > + struct sset *local_lports, > struct sset *egress_ifaces) > { > int i; > @@ -89,7 +89,7 @@ get_local_iface_ids(const struct ovsrec_bridge *br_int, > > if (iface_id) { > shash_add(lport_to_iface, iface_id, iface_rec); > - sset_add(all_lports, iface_id); > + sset_add(local_lports, iface_id); > } > > /* Check if this is a tunnel interface. */ > @@ -327,17 +327,17 @@ consider_local_datapath(struct controller_ctx *ctx, > struct hmap *qos_map, > struct hmap *local_datapaths, > struct shash *lport_to_iface, > - struct sset *all_lports) > + struct sset *local_lports) > { > const struct ovsrec_interface *iface_rec > = shash_find_data(lport_to_iface, binding_rec->logical_port); > > if (iface_rec > || (binding_rec->parent_port && binding_rec->parent_port[0] && > - sset_contains(all_lports, binding_rec->parent_port))) { > + sset_contains(local_lports, binding_rec->parent_port))) { > if (binding_rec->parent_port && binding_rec->parent_port[0]) { > /* Add child logical port to the set of all local ports. */ > - sset_add(all_lports, binding_rec->logical_port); > + sset_add(local_lports, binding_rec->logical_port); > } > add_local_datapath(ldatapaths, lports, binding_rec->datapath, > false, local_datapaths); > @@ -374,7 +374,7 @@ consider_local_datapath(struct controller_ctx *ctx, > return; > } > > - sset_add(all_lports, binding_rec->logical_port); > + sset_add(local_lports, binding_rec->logical_port); > add_local_datapath(ldatapaths, lports, binding_rec->datapath, > false, local_datapaths); > if (binding_rec->chassis == chassis_rec) { > @@ -400,14 +400,15 @@ consider_local_datapath(struct controller_ctx *ctx, > for (int i = 0; i < binding_rec->n_mac; i++) { > VLOG_INFO("Releasing %s", binding_rec->mac[i]); > } > + > sbrec_port_binding_set_chassis(binding_rec, NULL); > - sset_find_and_delete(all_lports, binding_rec->logical_port); > + sset_find_and_delete(local_lports, > binding_rec->logical_port); > } > } else if (!binding_rec->chassis > && !strcmp(binding_rec->type, "localnet")) { > - /* Add all localnet ports to all_lports so that we allocate ct > zones > + /* Add all localnet ports to local_lports so that we allocate ct > zones > * for them. */ > - sset_add(all_lports, binding_rec->logical_port); > + sset_add(local_lports, binding_rec->logical_port); > } > } > > @@ -416,7 +417,7 @@ binding_run(struct controller_ctx *ctx, const struct > ovsrec_bridge *br_int, > const struct sbrec_chassis *chassis_rec, > const struct ldatapath_index *ldatapaths, > const struct lport_index *lports, struct hmap > *local_datapaths, > - struct sset *all_lports) > + struct sset *local_lports) > { > if (!chassis_rec) { > return; > @@ -429,7 +430,7 @@ binding_run(struct controller_ctx *ctx, const struct > ovsrec_bridge *br_int, > > hmap_init(&qos_map); > if (br_int) { > - get_local_iface_ids(br_int, &lport_to_iface, all_lports, > + get_local_iface_ids(br_int, &lport_to_iface, local_lports, > &egress_ifaces); > } > > @@ -441,7 +442,7 @@ binding_run(struct controller_ctx *ctx, const struct > ovsrec_bridge *br_int, > chassis_rec, binding_rec, > sset_is_empty(&egress_ifaces) ? NULL : > &qos_map, local_datapaths, > &lport_to_iface, > - all_lports); > + local_lports); > > } > > diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn- > controller.c > index 6936c84..7a30c2a 100644 > --- a/ovn/controller/ovn-controller.c > +++ b/ovn/controller/ovn-controller.c > @@ -489,7 +489,13 @@ main(int argc, char *argv[]) > > /* Contains "struct local_datapath" nodes. */ > struct hmap local_datapaths = HMAP_INITIALIZER(&local_datapaths); > - struct sset all_lports = SSET_INITIALIZER(&all_lports); > + > + /* Contains the name of each logical port resident on the local > + * hypervisor. These logical ports include the VIFs (and their > child > + * logical ports, if any) that belong to VMs running on the > hypervisor, > + * l2gateway ports for which options:l2gateway-chassis designates > the > + * local hypervisor, and localnet ports. */ > + struct sset local_lports = SSET_INITIALIZER(&local_lports); > > const struct ovsrec_bridge *br_int = get_br_int(&ctx); > const char *chassis_id = get_chassis_id(ctx.ovs_idl); > @@ -506,7 +512,7 @@ main(int argc, char *argv[]) > chassis = chassis_run(&ctx, chassis_id, br_int); > encaps_run(&ctx, br_int, chassis_id); > binding_run(&ctx, br_int, chassis, &ldatapaths, &lports, > - &local_datapaths, &all_lports); > + &local_datapaths, &local_lports); > } > > if (br_int && chassis) { > @@ -516,7 +522,7 @@ main(int argc, char *argv[]) > > &pending_ct_zones); > > pinctrl_run(&ctx, &lports, br_int, chassis, &local_datapaths); > - update_ct_zones(&all_lports, &local_datapaths, &ct_zones, > + update_ct_zones(&local_lports, &local_datapaths, &ct_zones, > ct_zone_bitmap, &pending_ct_zones); > if (ctx.ovs_idl_txn) { > commit_ct_zones(br_int, &pending_ct_zones); > @@ -545,7 +551,7 @@ main(int argc, char *argv[]) > lport_index_destroy(&lports); > ldatapath_index_destroy(&ldatapaths); > > - sset_destroy(&all_lports); > + sset_destroy(&local_lports); > > struct local_datapath *cur_node, *next_node; > HMAP_FOR_EACH_SAFE (cur_node, next_node, hmap_node, > &local_datapaths) { > -- > 2.10.2 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c index 5f71a48..fbdcf67 100644 --- a/ovn/controller/binding.c +++ b/ovn/controller/binding.c @@ -67,7 +67,7 @@ binding_register_ovs_idl(struct ovsdb_idl *ovs_idl) static void get_local_iface_ids(const struct ovsrec_bridge *br_int, struct shash *lport_to_iface, - struct sset *all_lports, + struct sset *local_lports, struct sset *egress_ifaces) { int i; @@ -89,7 +89,7 @@ get_local_iface_ids(const struct ovsrec_bridge *br_int, if (iface_id) { shash_add(lport_to_iface, iface_id, iface_rec); - sset_add(all_lports, iface_id); + sset_add(local_lports, iface_id); } /* Check if this is a tunnel interface. */ @@ -327,17 +327,17 @@ consider_local_datapath(struct controller_ctx *ctx, struct hmap *qos_map, struct hmap *local_datapaths, struct shash *lport_to_iface, - struct sset *all_lports) + struct sset *local_lports) { const struct ovsrec_interface *iface_rec = shash_find_data(lport_to_iface, binding_rec->logical_port); if (iface_rec || (binding_rec->parent_port && binding_rec->parent_port[0] && - sset_contains(all_lports, binding_rec->parent_port))) { + sset_contains(local_lports, binding_rec->parent_port))) { if (binding_rec->parent_port && binding_rec->parent_port[0]) { /* Add child logical port to the set of all local ports. */ - sset_add(all_lports, binding_rec->logical_port); + sset_add(local_lports, binding_rec->logical_port); } add_local_datapath(ldatapaths, lports, binding_rec->datapath, false, local_datapaths); @@ -374,7 +374,7 @@ consider_local_datapath(struct controller_ctx *ctx, return; } - sset_add(all_lports, binding_rec->logical_port); + sset_add(local_lports, binding_rec->logical_port); add_local_datapath(ldatapaths, lports, binding_rec->datapath, false, local_datapaths); if (binding_rec->chassis == chassis_rec) { @@ -400,14 +400,15 @@ consider_local_datapath(struct controller_ctx *ctx, for (int i = 0; i < binding_rec->n_mac; i++) { VLOG_INFO("Releasing %s", binding_rec->mac[i]); } + sbrec_port_binding_set_chassis(binding_rec, NULL); - sset_find_and_delete(all_lports, binding_rec->logical_port); + sset_find_and_delete(local_lports, binding_rec->logical_port); } } else if (!binding_rec->chassis && !strcmp(binding_rec->type, "localnet")) { - /* Add all localnet ports to all_lports so that we allocate ct zones + /* Add all localnet ports to local_lports so that we allocate ct zones * for them. */ - sset_add(all_lports, binding_rec->logical_port); + sset_add(local_lports, binding_rec->logical_port); } } @@ -416,7 +417,7 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, const struct sbrec_chassis *chassis_rec, const struct ldatapath_index *ldatapaths, const struct lport_index *lports, struct hmap *local_datapaths, - struct sset *all_lports) + struct sset *local_lports) { if (!chassis_rec) { return; @@ -429,7 +430,7 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, hmap_init(&qos_map); if (br_int) { - get_local_iface_ids(br_int, &lport_to_iface, all_lports, + get_local_iface_ids(br_int, &lport_to_iface, local_lports, &egress_ifaces); } @@ -441,7 +442,7 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, chassis_rec, binding_rec, sset_is_empty(&egress_ifaces) ? NULL : &qos_map, local_datapaths, &lport_to_iface, - all_lports); + local_lports); } diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index 6936c84..7a30c2a 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -489,7 +489,13 @@ main(int argc, char *argv[]) /* Contains "struct local_datapath" nodes. */ struct hmap local_datapaths = HMAP_INITIALIZER(&local_datapaths); - struct sset all_lports = SSET_INITIALIZER(&all_lports); + + /* Contains the name of each logical port resident on the local + * hypervisor. These logical ports include the VIFs (and their child + * logical ports, if any) that belong to VMs running on the hypervisor, + * l2gateway ports for which options:l2gateway-chassis designates the + * local hypervisor, and localnet ports. */ + struct sset local_lports = SSET_INITIALIZER(&local_lports); const struct ovsrec_bridge *br_int = get_br_int(&ctx); const char *chassis_id = get_chassis_id(ctx.ovs_idl); @@ -506,7 +512,7 @@ main(int argc, char *argv[]) chassis = chassis_run(&ctx, chassis_id, br_int); encaps_run(&ctx, br_int, chassis_id); binding_run(&ctx, br_int, chassis, &ldatapaths, &lports, - &local_datapaths, &all_lports); + &local_datapaths, &local_lports); } if (br_int && chassis) { @@ -516,7 +522,7 @@ main(int argc, char *argv[]) &pending_ct_zones); pinctrl_run(&ctx, &lports, br_int, chassis, &local_datapaths); - update_ct_zones(&all_lports, &local_datapaths, &ct_zones, + update_ct_zones(&local_lports, &local_datapaths, &ct_zones, ct_zone_bitmap, &pending_ct_zones); if (ctx.ovs_idl_txn) { commit_ct_zones(br_int, &pending_ct_zones); @@ -545,7 +551,7 @@ main(int argc, char *argv[]) lport_index_destroy(&lports); ldatapath_index_destroy(&ldatapaths); - sset_destroy(&all_lports); + sset_destroy(&local_lports); struct local_datapath *cur_node, *next_node; HMAP_FOR_EACH_SAFE (cur_node, next_node, hmap_node, &local_datapaths) {
This sset has always just contained the names of logical ports that are local to the current hypervisor, but the name 'all_lports' implied that it contained the name of every logical port. Signed-off-by: Ben Pfaff <blp@ovn.org> --- ovn/controller/binding.c | 25 +++++++++++++------------ ovn/controller/ovn-controller.c | 14 ++++++++++---- 2 files changed, 23 insertions(+), 16 deletions(-)