[ovs-dev,ovn,13/19] ovn-sb: Add columns is_interconn and is_remote to Chassis.
diff mbox series

Message ID 1571619079-75503-14-git-send-email-hzhou@ovn.org
State New
Headers show
Series
  • OVN Interconnection
Related show

Commit Message

Han Zhou Oct. 21, 2019, 12:51 a.m. UTC
Support the new columns in Chassis table for OVN interconnection.
Also, populate the is_interconn column according to external_ids:
is-interconn key of Open_vSwitch table on the chassis.

Signed-off-by: Han Zhou <hzhou@ovn.org>
---
 controller/chassis.c | 14 ++++++++++++++
 northd/ovn-northd.c  |  6 ++++--
 ovn-sb.ovsschema     |  8 +++++---
 ovn-sb.xml           | 15 +++++++++++++++
 4 files changed, 38 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/controller/chassis.c b/controller/chassis.c
index 699b662..47ca75e 100644
--- a/controller/chassis.c
+++ b/controller/chassis.c
@@ -92,6 +92,8 @@  struct ovs_chassis_cfg {
     struct sset encap_ip_set;
     /* Interface type list formatted in the OVN-SB Chassis required format. */
     struct ds iface_types;
+    /* Is this chassis an interconnection gateway. */
+    bool is_interconn;
 };
 
 static void
@@ -172,6 +174,12 @@  get_datapath_type(const struct ovsrec_bridge *br_int)
     return "";
 }
 
+static bool
+get_is_interconn(const struct smap *ext_ids)
+{
+    return smap_get_bool(ext_ids, "is-interconn", false);
+}
+
 static void
 update_chassis_transport_zones(const struct sset *transport_zones,
                                const struct sbrec_chassis *chassis_rec)
@@ -285,6 +293,8 @@  chassis_parse_ovs_config(const struct ovsrec_open_vswitch_table *ovs_table,
         sset_destroy(&ovs_cfg->encap_ip_set);
     }
 
+    ovs_cfg->is_interconn = get_is_interconn(&cfg->external_ids);
+
     return true;
 }
 
@@ -539,6 +549,10 @@  chassis_update(const struct sbrec_chassis *chassis_rec,
 
     update_chassis_transport_zones(transport_zones, chassis_rec);
 
+    if (ovs_cfg->is_interconn != chassis_rec->is_interconn) {
+        sbrec_chassis_set_is_interconn(chassis_rec, ovs_cfg->is_interconn);
+    }
+
     /* If any of the encaps should change, update them. */
     bool tunnels_changed =
         chassis_tunnels_changed(&ovs_cfg->encap_type_set,
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index ccce96a..fd0b081 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -9574,7 +9574,8 @@  check_and_add_supported_dhcpv6_opts_to_sb_db(struct northd_context *ctx)
 static const char *rbac_chassis_auth[] =
     {"name"};
 static const char *rbac_chassis_update[] =
-    {"nb_cfg", "external_ids", "encaps", "vtep_logical_switches"};
+    {"nb_cfg", "external_ids", "encaps", "vtep_logical_switches",
+     "is_interconn"};
 
 static const char *rbac_encap_auth[] =
     {"chassis_name"};
@@ -9772,7 +9773,7 @@  update_northbound_cfg(struct northd_context *ctx,
         const struct sbrec_chassis *chassis;
         int64_t hv_cfg = nbg->nb_cfg;
         SBREC_CHASSIS_FOR_EACH (chassis, ctx->ovnsb_idl) {
-            if (chassis->nb_cfg < hv_cfg) {
+            if (!chassis->is_remote && chassis->nb_cfg < hv_cfg) {
                 hv_cfg = chassis->nb_cfg;
             }
         }
@@ -10059,6 +10060,7 @@  main(int argc, char *argv[])
     ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_chassis);
     ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_nb_cfg);
     ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_name);
+    ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_is_remote);
 
     ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_ha_chassis);
     add_column_noalert(ovnsb_idl_loop.idl,
diff --git a/ovn-sb.ovsschema b/ovn-sb.ovsschema
index 5c013b1..30b622d 100644
--- a/ovn-sb.ovsschema
+++ b/ovn-sb.ovsschema
@@ -1,7 +1,7 @@ 
 {
     "name": "OVN_Southbound",
-    "version": "2.5.0",
-    "cksum": "1257419092 20387",
+    "version": "2.6.0",
+    "cksum": "1645368988 20492",
     "tables": {
         "SB_Global": {
             "columns": {
@@ -40,7 +40,9 @@ 
                              "min": 0, "max": "unlimited"}},
                 "transport_zones" : {"type": {"key": "string",
                                               "min": 0,
-                                              "max": "unlimited"}}},
+                                              "max": "unlimited"}},
+                "is_interconn" : {"type": "boolean"},
+                "is_remote" : {"type": "boolean"}},
             "isRoot": true,
             "indexes": [["name"]]},
         "Encap": {
diff --git a/ovn-sb.xml b/ovn-sb.xml
index 471310d..b27bb82 100644
--- a/ovn-sb.xml
+++ b/ovn-sb.xml
@@ -301,6 +301,21 @@ 
       See <code>ovn-controller</code>(8) for more information.
     </column>
 
+    <column name="is_interconn">
+      <code>ovn-controller</code> populates this column with the setting
+      configured in the <ref table="Open_vSwitch"
+      column="external_ids:is-interconn"/> column of the Open_vSwitch
+      database's <ref table="Open_vSwitch" db="Open_vSwitch"/> table.
+      If set to true, the chassis is used as an interconnection gateway.
+      See <code>ovn-controller</code>(8) for more information.
+    </column>
+
+    <column name="is_remote">
+      <code>ovn-ic</code> set this column true for remote interconnection
+      gateway chassises learned from the interconnection southbound database.
+      See <code>ovn-ic</code>(8) for more information.
+    </column>
+
     <column name="external_ids" key="ovn-chassis-mac-mappings">
       <code>ovn-controller</code> populates this key with the set of options
       configured in the <ref table="Open_vSwitch"