On Tue, Jun 6, 2017 at 6:08 AM, Daniel Alvarez <dalva...@redhat.com> wrote: > This patch makes ovn-northd copy all string-string pairs in > external_ids column of the Logical_Switch_Port table in Northbound > database to the equivalent column of the Port_Binding table in > Southbound database. > > OpenStack Neutron will add some useful data to NB database that can be > later read by networking-ovn-metadata-agent without the need of > maintaining a connection to NB database. This data would include > the CIDR's of a port or the project and device ID's which are needed > when talking to Nova to request metadata. > > Signed-off-by: Daniel Alvarez <dalva...@redhat.com> > --- > ovn/northd/ovn-northd.c | 11 +++++++---- > ovn/ovn-nb.xml | 11 ++++++++++- > ovn/ovn-sb.xml | 11 ++++++++++- > 3 files changed, 27 insertions(+), 6 deletions(-)
Thanks for the patch. I applied to master, with a couple of minor changes listed below. > > diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c > index 5914988..a063a05 100644 > --- a/ovn/northd/ovn-northd.c > +++ b/ovn/northd/ovn-northd.c > @@ -1814,10 +1814,13 @@ ovn_port_update_sbrec(const struct ovn_port *op, > op->nbsp->n_addresses); > > struct smap ids = SMAP_INITIALIZER(&ids); > - const char *name = smap_get(&op->nbsp->external_ids, > - "neutron:port_name"); > - if (name && name[0]) { > - smap_add(&ids, "name", name); > + smap_clone(&ids, &op->nbsp->external_ids); > + const char *name = smap_get(&ids, "neutron:port_name"); > + if (name) { > + smap_remove(&ids, "neutron:port_name"); > + if (name[0]) { > + smap_add(&ids, "name", name); > + } > } > sbrec_port_binding_set_external_ids(op->sb, &ids); > } I added smap_destroy(&ids) to fix a memory leak here. It appears the bug was there from before your changes. I also removed the smap_remove(). I wouldn't expect "neutron:port_name" to be removed based on the way we have this documented. I still think it makes sense to keep "name" as the previous code added it. diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index a063a05..4466f22 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -1816,13 +1816,11 @@ ovn_port_update_sbrec(const struct ovn_port *op, struct smap ids = SMAP_INITIALIZER(&ids); smap_clone(&ids, &op->nbsp->external_ids); const char *name = smap_get(&ids, "neutron:port_name"); - if (name) { - smap_remove(&ids, "neutron:port_name"); - if (name[0]) { - smap_add(&ids, "name", name); - } + if (name && name[0]) { + smap_add(&ids, "name", name); } sbrec_port_binding_set_external_ids(op->sb, &ids); + smap_destroy(&ids); } } > diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml > index eb348fe..7bb322f 100644 > --- a/ovn/ovn-nb.xml > +++ b/ovn/ovn-nb.xml > @@ -848,7 +848,16 @@ > > <group title="Common Columns"> > <column name="external_ids"> > - See <em>External IDs</em> at the beginning of this document. > + <p> > + See <em>External IDs</em> at the beginning of this document. > + </p> > + > + <p> > + The <code>ovn-northd</code> program copies all these pairs into the > + <ref column="external_ids"/> column of the > + <ref table="Port_Binding"/> table in <ref db="OVN_Southbound"/> > + database. > + </p> > </column> > </group> > </table> > diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml > index f3c3212..0e0fe12 100644 > --- a/ovn/ovn-sb.xml > +++ b/ovn/ovn-sb.xml > @@ -2179,7 +2179,16 @@ tcp.flags = RST; > > <group title="Common Columns"> > <column name="external_ids"> > - See <em>External IDs</em> at the beginning of this document. > + <p> > + See <em>External IDs</em> at the beginning of this document. > + </p> > + > + <p> > + The <code>ovn-northd</code> program populates this column with > + all entries into the <ref column="external_ids"/> column of the > + <ref table="Logical_Switch_Port"/> table of the > + <ref db="OVN_Northbound"/> database. > + </p> > </column> > </group> > </table> > -- > 1.8.3.1 > > _______________________________________________ > dev mailing list > d...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev -- Russell Bryant _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev