[ovs-dev] [PATCH] ovn: use name instead of uuid as key of logical router ports

Han Zhou zhouhan at gmail.com
Thu Nov 5 23:11:49 UTC 2015


Before this patch, logical switch ports were using name as key but
logical router ports using uuid, which confuses user when trouble-
shooting, and names of patch ports unreadable. This patch unifies
it by using "name" field also for logical router ports.

Signed-off-by: Han Zhou <zhouhan at gmail.com>
---
 ovn/northd/ovn-northd.c | 10 +++-------
 ovn/ovn-nb.ovsschema    |  5 +++--
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 60786d2..137bc1c 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -594,23 +594,20 @@ join_logical_ports(struct northd_context *ctx,
                     continue;
                 }

-                char name[UUID_LEN + 1];
-                snprintf(name, sizeof name, UUID_FMT,
-                         UUID_ARGS(&nbr->header_.uuid));
-                struct ovn_port *op = ovn_port_find(ports, name);
+                struct ovn_port *op = ovn_port_find(ports, nbr->name);
                 if (op) {
                     if (op->nbs || op->nbr) {
                         static struct vlog_rate_limit rl
                             = VLOG_RATE_LIMIT_INIT(5, 1);
                         VLOG_WARN_RL(&rl, "duplicate logical router port
%s",
-                                     name);
+                                     nbr->name);
                         continue;
                     }
                     op->nbr = nbr;
                     list_remove(&op->list);
                     list_push_back(both, &op->list);
                 } else {
-                    op = ovn_port_create(ports, name, NULL, nbr, NULL);
+                    op = ovn_port_create(ports, nbr->name, NULL, nbr,
NULL);
                     list_push_back(nb_only, &op->list);
                 }

@@ -1453,7 +1450,6 @@ build_lrouter_flows(struct hmap *datapaths, struct
hmap *ports,
             for (size_t i = 0; i < op->nbs->n_addresses; i++) {
                 struct eth_addr ea;
                 ovs_be32 ip;
-
                 if (ovs_scan(op->nbs->addresses[i],
                              ETH_ADDR_SCAN_FMT" "IP_SCAN_FMT,
                              ETH_ADDR_SCAN_ARGS(ea), IP_SCAN_ARGS(&ip))) {
diff --git a/ovn/ovn-nb.ovsschema b/ovn/ovn-nb.ovsschema
index 3921e98..9aa5b7f 100644
--- a/ovn/ovn-nb.ovsschema
+++ b/ovn/ovn-nb.ovsschema
@@ -1,7 +1,7 @@
 {
     "name": "OVN_Northbound",
-    "version": "2.0.0",
-    "cksum": "3039293926 4601",
+    "version": "2.0.1",
+    "cksum": "2854670130 4636",
     "tables": {
         "Logical_Switch": {
             "columns": {
@@ -89,5 +89,6 @@
                 "external_ids": {
                     "type": {"key": "string", "value": "string",
                              "min": 0, "max": "unlimited"}}},
+            "indexes": [["name"]],
             "isRoot": false}},
     "version": "1.0.0"}
-- 
2.1.0



More information about the dev mailing list