Message ID | 20220518174728.3366-1-dceara@redhat.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev,v2] ovn-controller: Consider zone 0 as a valid zone when restoring. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/github-robot-_ovn-kubernetes | success | github build: passed |
Looks good to me Dumitru. Acked-by: Mark Michelson <mmichels@redhat.com> On 5/18/22 13:47, Dumitru Ceara wrote: > 0 is a valid zone ID and some CMSs might actually use it. > > Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2087194 > Signed-off-by: Dumitru Ceara <dceara@redhat.com> > --- > v2: Use str_to_uint() as suggested by Ilya. > --- > controller/ovn-controller.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c > index 0efe5c5ce..dfe30d1d1 100644 > --- a/controller/ovn-controller.c > +++ b/controller/ovn-controller.c > @@ -825,13 +825,18 @@ restore_ct_zones(const struct ovsrec_bridge_table *bridge_table, > } > > const char *user = node->key + 8; > - int zone = atoi(node->value); > + if (!user[0]) { > + continue; > + } > > - if (user[0] && zone) { > - VLOG_DBG("restoring ct zone %"PRId32" for '%s'", zone, user); > - bitmap_set1(ct_zone_bitmap, zone); > - simap_put(ct_zones, user, zone); > + unsigned int zone; > + if (!str_to_uint(node->value, 10, &zone)) { > + continue; > } > + > + VLOG_DBG("restoring ct zone %"PRId32" for '%s'", zone, user); > + bitmap_set1(ct_zone_bitmap, zone); > + simap_put(ct_zones, user, zone); > } > } > >
On Wed, May 18, 2022 at 4:41 PM Mark Michelson <mmichels@redhat.com> wrote: > > Looks good to me Dumitru. > > Acked-by: Mark Michelson <mmichels@redhat.com> Thanks Dumiru and Mark. I applied this patch to the main branch and backported to branch-22.03 and branch-21.12. Numan > > On 5/18/22 13:47, Dumitru Ceara wrote: > > 0 is a valid zone ID and some CMSs might actually use it. > > > > Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2087194 > > Signed-off-by: Dumitru Ceara <dceara@redhat.com> > > --- > > v2: Use str_to_uint() as suggested by Ilya. > > --- > > controller/ovn-controller.c | 15 ++++++++++----- > > 1 file changed, 10 insertions(+), 5 deletions(-) > > > > diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c > > index 0efe5c5ce..dfe30d1d1 100644 > > --- a/controller/ovn-controller.c > > +++ b/controller/ovn-controller.c > > @@ -825,13 +825,18 @@ restore_ct_zones(const struct ovsrec_bridge_table *bridge_table, > > } > > > > const char *user = node->key + 8; > > - int zone = atoi(node->value); > > + if (!user[0]) { > > + continue; > > + } > > > > - if (user[0] && zone) { > > - VLOG_DBG("restoring ct zone %"PRId32" for '%s'", zone, user); > > - bitmap_set1(ct_zone_bitmap, zone); > > - simap_put(ct_zones, user, zone); > > + unsigned int zone; > > + if (!str_to_uint(node->value, 10, &zone)) { > > + continue; > > } > > + > > + VLOG_DBG("restoring ct zone %"PRId32" for '%s'", zone, user); > > + bitmap_set1(ct_zone_bitmap, zone); > > + simap_put(ct_zones, user, zone); > > } > > } > > > > > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 0efe5c5ce..dfe30d1d1 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -825,13 +825,18 @@ restore_ct_zones(const struct ovsrec_bridge_table *bridge_table, } const char *user = node->key + 8; - int zone = atoi(node->value); + if (!user[0]) { + continue; + } - if (user[0] && zone) { - VLOG_DBG("restoring ct zone %"PRId32" for '%s'", zone, user); - bitmap_set1(ct_zone_bitmap, zone); - simap_put(ct_zones, user, zone); + unsigned int zone; + if (!str_to_uint(node->value, 10, &zone)) { + continue; } + + VLOG_DBG("restoring ct zone %"PRId32" for '%s'", zone, user); + bitmap_set1(ct_zone_bitmap, zone); + simap_put(ct_zones, user, zone); } }
0 is a valid zone ID and some CMSs might actually use it. Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2087194 Signed-off-by: Dumitru Ceara <dceara@redhat.com> --- v2: Use str_to_uint() as suggested by Ilya. --- controller/ovn-controller.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)