[ovs-dev] [PATCH ovn v5] ovn: Rename ovn-nbd to ovn-northd.

Russell Bryant rbryant at redhat.com
Thu Apr 16 21:13:54 UTC 2015


It came up in a recent discussion that the use of 'nbd' could cause
confusion since nbd is used for "Network Block Device", which may be
used in many of the same environments that OVN would be used in.

To avoid the possible issue, just rename ovn-nbd to ovn-northd.
While we're at it, create a subdirectory under ovn/ to hold all files
related to ovn-northd.  For now it's just a single C file, but we
may add more source files in the future.

Signed-off-by: Russell Bryant <rbryant at redhat.com>
---

v5:
 - This patch had been tacked on to the end of a couple of different unrelated
   patch sets.  It's really a completely unrelated change, so it's now split out
   to be on its own.

 ovn/.gitignore             |   1 -
 ovn/TODO                   |   6 +-
 ovn/automake.mk            |   6 +-
 ovn/northd/.gitignore      |   1 +
 ovn/northd/automake.mk     |   4 +
 ovn/northd/ovn-northd.c    | 518 +++++++++++++++++++++++++++++++++++++++++++++
 ovn/ovn-architecture.7.xml |  62 +++---
 ovn/ovn-nb.xml             |  10 +-
 ovn/ovn-nbd.c              | 518 ---------------------------------------------
 ovn/ovn-sb.xml             |   8 +-
 tutorial/ovs-sandbox       |  12 +-
 11 files changed, 574 insertions(+), 572 deletions(-)
 create mode 100644 ovn/northd/.gitignore
 create mode 100644 ovn/northd/automake.mk
 create mode 100644 ovn/northd/ovn-northd.c
 delete mode 100644 ovn/ovn-nbd.c

diff --git a/ovn/.gitignore b/ovn/.gitignore
index cbd65a1..8f6a631 100644
--- a/ovn/.gitignore
+++ b/ovn/.gitignore
@@ -13,4 +13,3 @@
 /ovn-sb-idl.ovsidl
 /ovn-nbctl
 /ovn-nbctl.8
-/ovn-nbd
diff --git a/ovn/TODO b/ovn/TODO
index 3b5d97e..2e563ea 100644
--- a/ovn/TODO
+++ b/ovn/TODO
@@ -2,7 +2,7 @@
 
   ovn-controller is the primary user of flow match expressions, but
   the same syntax and I imagine the same code ought to be useful in
-  ovn-nbd for ACL match expressions.
+  ovn-northd for ACL match expressions.
 
 * ovn-controller
 
@@ -118,7 +118,7 @@
 
     Can probably get this from Open_vSwitch database.
 
-* ovn-nbd
+* ovn-northd
 
 ** Monitor OVN_Northbound database, trigger Pipeline recomputation on change.
 
@@ -234,7 +234,7 @@
 
    No details yet.
 
-** Init scripts for ovn-controller (on HVs), ovn-nbd, OVN DB server.
+** Init scripts for ovn-controller (on HVs), ovn-northd, OVN DB server.
 
 ** Distribution packaging.
 
diff --git a/ovn/automake.mk b/ovn/automake.mk
index 1609d70..672ef3f 100644
--- a/ovn/automake.mk
+++ b/ovn/automake.mk
@@ -123,10 +123,6 @@ bin_PROGRAMS += ovn/ovn-nbctl
 ovn_ovn_nbctl_SOURCES = ovn/ovn-nbctl.c
 ovn_ovn_nbctl_LDADD = ovn/libovn.la ovsdb/libovsdb.la lib/libopenvswitch.la
 
-# ovn-nbd
-bin_PROGRAMS += ovn/ovn-nbd
-ovn_ovn_nbd_SOURCES = ovn/ovn-nbd.c
-ovn_ovn_nbd_LDADD = ovn/libovn.la ovsdb/libovsdb.la lib/libopenvswitch.la
-
 include ovn/controller/automake.mk
 include ovn/lib/automake.mk
+include ovn/northd/automake.mk
diff --git a/ovn/northd/.gitignore b/ovn/northd/.gitignore
new file mode 100644
index 0000000..c0a87ab
--- /dev/null
+++ b/ovn/northd/.gitignore
@@ -0,0 +1 @@
+/ovn-northd
diff --git a/ovn/northd/automake.mk b/ovn/northd/automake.mk
new file mode 100644
index 0000000..c9c64c0
--- /dev/null
+++ b/ovn/northd/automake.mk
@@ -0,0 +1,4 @@
+# ovn-northd
+bin_PROGRAMS += ovn/northd/ovn-northd
+ovn_northd_ovn_northd_SOURCES = ovn/northd/ovn-northd.c
+ovn_northd_ovn_northd_LDADD = ovn/libovn.la ovsdb/libovsdb.la lib/libopenvswitch.la
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
new file mode 100644
index 0000000..241d6ec
--- /dev/null
+++ b/ovn/northd/ovn-northd.c
@@ -0,0 +1,518 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <config.h>
+
+#include <getopt.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "command-line.h"
+#include "daemon.h"
+#include "dirs.h"
+#include "fatal-signal.h"
+#include "hash.h"
+#include "hmap.h"
+#include "ovn/ovn-nb-idl.h"
+#include "ovn/ovn-sb-idl.h"
+#include "poll-loop.h"
+#include "stream.h"
+#include "stream-ssl.h"
+#include "util.h"
+#include "uuid.h"
+#include "openvswitch/vlog.h"
+
+VLOG_DEFINE_THIS_MODULE(ovn_nbd);
+
+struct nbd_context {
+    struct ovsdb_idl *ovnnb_idl;
+    struct ovsdb_idl *ovnsb_idl;
+    struct ovsdb_idl_txn *ovnnb_txn;
+    struct ovsdb_idl_txn *ovnsb_txn;
+};
+
+static const char *ovnnb_db;
+static const char *ovnsb_db;
+
+static const char *default_db(void);
+
+static void
+usage(void)
+{
+    printf("\
+%s: OVN northbound management daemon\n\
+usage: %s [OPTIONS]\n\
+\n\
+Options:\n\
+  --ovnnb-db=DATABASE       connect to ovn-nb database at DATABASE\n\
+                            (default: %s)\n\
+  --ovnsb-db=DATABASE       connect to ovn-sb database at DATABASE\n\
+                            (default: %s)\n\
+  -h, --help                display this help message\n\
+  -o, --options             list available options\n\
+  -V, --version             display version information\n\
+", program_name, program_name, default_db(), default_db());
+    daemon_usage();
+    vlog_usage();
+    stream_usage("database", true, true, false);
+}
+
+static int
+compare_strings(const void *a_, const void *b_)
+{
+    char *const *a = a_;
+    char *const *b = b_;
+    return strcmp(*a, *b);
+}
+
+/*
+ * Determine whether 2 arrays of MAC addresses are the same.  It's possible that
+ * the lists could be *very* long and this check is being done a lot (every
+ * time the OVN_Northbound database changes).
+ */
+static bool
+macs_equal(char **binding_macs_, size_t b_n_macs,
+           char **lport_macs_, size_t l_n_macs)
+{
+    char **binding_macs, **lport_macs;
+    size_t bytes, i;
+
+    if (b_n_macs != l_n_macs) {
+        return false;
+    }
+
+    bytes = b_n_macs * sizeof binding_macs_[0];
+    binding_macs = xmalloc(bytes);
+    lport_macs = xmalloc(bytes);
+
+    memcpy(binding_macs, binding_macs_, bytes);
+    memcpy(lport_macs, lport_macs_, bytes);
+
+    qsort(binding_macs, b_n_macs, sizeof binding_macs[0], compare_strings);
+    qsort(lport_macs, l_n_macs, sizeof lport_macs[0], compare_strings);
+
+    for (i = 0; i < b_n_macs; i++) {
+        if (strcmp(binding_macs[i], lport_macs[i])) {
+            break;
+        }
+    }
+
+    free(binding_macs);
+    free(lport_macs);
+
+    return (i == b_n_macs) ? true : false;
+}
+
+/*
+ * When a change has occurred in the OVN_Northbound database, we go through and
+ * make sure that the contents of the Bindings table in the OVN_Southbound
+ * database are up to date with the logical ports defined in the
+ * OVN_Northbound database.
+ */
+static void
+set_bindings(struct nbd_context *ctx)
+{
+    struct hmap bindings_hmap;
+    const struct sbrec_bindings *binding;
+    const struct nbrec_logical_port *lport;
+
+    struct binding_hash_node {
+        struct hmap_node node;
+        const struct sbrec_bindings *binding;
+    } *hash_node, *hash_node_next;
+
+    /*
+     * We will need to look up a binding for every logical port.  We don't want
+     * to have to do an O(n) search for every binding, so start out by hashing
+     * them on the logical port.
+     *
+     * As we go through every logical port, we will update the binding if it
+     * exists or create one otherwise.  When the update is done, we'll remove it
+     * from the hashmap.  At the end, any bindings left in the hashmap are for
+     * logical ports that have been deleted.
+     */
+    hmap_init(&bindings_hmap);
+
+    SBREC_BINDINGS_FOR_EACH(binding, ctx->ovnsb_idl) {
+        hash_node = xzalloc(sizeof *hash_node);
+        hash_node->binding = binding;
+        hmap_insert(&bindings_hmap, &hash_node->node,
+                hash_string(binding->logical_port, 0));
+    }
+
+    NBREC_LOGICAL_PORT_FOR_EACH(lport, ctx->ovnnb_idl) {
+        binding = NULL;
+        HMAP_FOR_EACH_WITH_HASH(hash_node, node,
+                hash_string(lport->name, 0), &bindings_hmap) {
+            if (!strcmp(lport->name, hash_node->binding->logical_port)) {
+                binding = hash_node->binding;
+                break;
+            }
+        }
+
+        if (binding) {
+            /* We found an existing binding for this logical port.  Update its
+             * contents.  Right now the only thing we expect that could change
+             * is the list of MAC addresses. */
+
+            hmap_remove(&bindings_hmap, &hash_node->node);
+            free(hash_node);
+            hash_node = NULL;
+
+            if (!macs_equal(binding->mac, binding->n_mac,
+                        lport->macs, lport->n_macs)) {
+                sbrec_bindings_set_mac(binding,
+                        (const char **) lport->macs, lport->n_macs);
+            }
+        } else {
+            /* There is no binding for this logical port, so create one. */
+
+            binding = sbrec_bindings_insert(ctx->ovnsb_txn);
+            sbrec_bindings_set_logical_port(binding, lport->name);
+            sbrec_bindings_set_mac(binding,
+                    (const char **) lport->macs, lport->n_macs);
+        }
+    }
+
+    HMAP_FOR_EACH_SAFE(hash_node, hash_node_next, node, &bindings_hmap) {
+        hmap_remove(&bindings_hmap, &hash_node->node);
+        sbrec_bindings_delete(hash_node->binding);
+        free(hash_node);
+    }
+    hmap_destroy(&bindings_hmap);
+}
+
+static void
+ovnnb_db_changed(struct nbd_context *ctx)
+{
+    VLOG_DBG("ovn-northd: ovn-nb db contents have changed.\n");
+
+    set_bindings(ctx);
+}
+
+/*
+ * The only change we get notified about is if the 'chassis' column of the
+ * 'Bindings' table changes.  When this column is not empty, it means we need to
+ * set the corresponding logical port as 'up' in the northbound DB.
+ */
+static void
+ovnsb_db_changed(struct nbd_context *ctx)
+{
+    struct hmap lports_hmap;
+    const struct sbrec_bindings *binding;
+    const struct nbrec_logical_port *lport;
+
+    struct lport_hash_node {
+        struct hmap_node node;
+        const struct nbrec_logical_port *lport;
+    } *hash_node, *hash_node_next;
+
+    VLOG_DBG("Recalculating port up states for ovn-nb db.");
+
+    hmap_init(&lports_hmap);
+
+    NBREC_LOGICAL_PORT_FOR_EACH(lport, ctx->ovnnb_idl) {
+        hash_node = xzalloc(sizeof *hash_node);
+        hash_node->lport = lport;
+        hmap_insert(&lports_hmap, &hash_node->node,
+                hash_string(lport->name, 0));
+    }
+
+    SBREC_BINDINGS_FOR_EACH(binding, ctx->ovnsb_idl) {
+        lport = NULL;
+        HMAP_FOR_EACH_WITH_HASH(hash_node, node,
+                hash_string(binding->logical_port, 0), &lports_hmap) {
+            if (!strcmp(binding->logical_port, hash_node->lport->name)) {
+                lport = hash_node->lport;
+                break;
+            }
+        }
+
+        if (!lport) {
+            /* The logical port doesn't exist for this binding.  This can happen
+             * under normal circumstances when ovn-nbd hasn't gotten around to
+             * pruning the Binding yet. */
+            continue;
+        }
+
+        if (*binding->chassis && (!lport->up || !*lport->up)) {
+            bool up = true;
+            nbrec_logical_port_set_up(lport, &up, 1);
+        } else if (!*binding->chassis && (!lport->up || *lport->up)) {
+            bool up = false;
+            nbrec_logical_port_set_up(lport, &up, 1);
+        }
+    }
+
+    HMAP_FOR_EACH_SAFE(hash_node, hash_node_next, node, &lports_hmap) {
+        hmap_remove(&lports_hmap, &hash_node->node);
+        free(hash_node);
+    }
+    hmap_destroy(&lports_hmap);
+}
+
+static const char *
+default_db(void)
+{
+    static char *def;
+    if (!def) {
+        def = xasprintf("unix:%s/db.sock", ovs_rundir());
+    }
+    return def;
+}
+
+static void
+parse_options(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+{
+    enum {
+        DAEMON_OPTION_ENUMS,
+        VLOG_OPTION_ENUMS,
+    };
+    static const struct option long_options[] = {
+        {"ovnsb-db", required_argument, NULL, 'd'},
+        {"ovnnb-db", required_argument, NULL, 'D'},
+        {"help", no_argument, NULL, 'h'},
+        {"options", no_argument, NULL, 'o'},
+        {"version", no_argument, NULL, 'V'},
+        DAEMON_LONG_OPTIONS,
+        VLOG_LONG_OPTIONS,
+        STREAM_SSL_LONG_OPTIONS,
+        {NULL, 0, NULL, 0},
+    };
+    char *short_options = ovs_cmdl_long_options_to_short_options(long_options);
+
+    for (;;) {
+        int c;
+
+        c = getopt_long(argc, argv, short_options, long_options, NULL);
+        if (c == -1) {
+            break;
+        }
+
+        switch (c) {
+        DAEMON_OPTION_HANDLERS;
+        VLOG_OPTION_HANDLERS;
+        STREAM_SSL_OPTION_HANDLERS;
+
+        case 'd':
+            ovnsb_db = optarg;
+            break;
+
+        case 'D':
+            ovnnb_db = optarg;
+            break;
+
+        case 'h':
+            usage();
+            exit(EXIT_SUCCESS);
+
+        case 'o':
+            ovs_cmdl_print_options(long_options);
+            exit(EXIT_SUCCESS);
+
+        case 'V':
+            ovs_print_version(0, 0);
+            exit(EXIT_SUCCESS);
+
+        default:
+            break;
+        }
+    }
+
+    if (!ovnsb_db) {
+        ovnsb_db = default_db();
+    }
+
+    if (!ovnnb_db) {
+        ovnnb_db = default_db();
+    }
+
+    free(short_options);
+}
+
+int
+main(int argc, char *argv[])
+{
+    extern struct vlog_module VLM_reconnect;
+    struct ovsdb_idl *ovnnb_idl, *ovnsb_idl;
+    unsigned int ovnnb_seqno, ovn_seqno;
+    int res = EXIT_SUCCESS;
+    struct nbd_context ctx = {
+        .ovnsb_txn = NULL,
+    };
+    bool ovnnb_changes_pending = false;
+    bool ovn_changes_pending = false;
+
+    fatal_ignore_sigpipe();
+    set_program_name(argv[0]);
+    vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
+    vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_WARN);
+    parse_options(argc, argv);
+
+    daemonize();
+
+    nbrec_init();
+    sbrec_init();
+
+    /* We want to detect all changes to the ovn-nb db. */
+    ctx.ovnnb_idl = ovnnb_idl = ovsdb_idl_create(ovnnb_db,
+            &nbrec_idl_class, true, true);
+
+    /* There is only a small subset of changes to the ovn-sb db that ovn-northd
+     * has to care about, so we'll enable monitoring those directly. */
+    ctx.ovnsb_idl = ovnsb_idl = ovsdb_idl_create(ovnsb_db,
+            &sbrec_idl_class, false, true);
+    ovsdb_idl_add_table(ovnsb_idl, &sbrec_table_bindings);
+    ovsdb_idl_add_column(ovnsb_idl, &sbrec_bindings_col_logical_port);
+    ovsdb_idl_add_column(ovnsb_idl, &sbrec_bindings_col_chassis);
+    ovsdb_idl_add_column(ovnsb_idl, &sbrec_bindings_col_mac);
+
+    /*
+     * The loop here just runs the IDL in a loop waiting for the seqno to
+     * change, which indicates that the contents of the db have changed.
+     *
+     * If the contents of the ovn-nb db change, the mappings to the ovn-sb
+     * db must be recalculated.
+     *
+     * If the contents of the ovn-sb db change, it means the 'up' state of
+     * a port may have changed, as that's the only type of change ovn-northd is
+     * watching for.
+     */
+
+    ovnnb_seqno = ovsdb_idl_get_seqno(ovnnb_idl);
+    ovn_seqno = ovsdb_idl_get_seqno(ovnsb_idl);
+    for (;;) {
+        ovsdb_idl_run(ovnnb_idl);
+        ovsdb_idl_run(ovnsb_idl);
+
+        if (!ovsdb_idl_is_alive(ovnnb_idl)) {
+            int retval = ovsdb_idl_get_last_error(ovnnb_idl);
+            VLOG_ERR("%s: database connection failed (%s)",
+                    ovnnb_db, ovs_retval_to_string(retval));
+            res = EXIT_FAILURE;
+            break;
+        }
+
+        if (!ovsdb_idl_is_alive(ovnsb_idl)) {
+            int retval = ovsdb_idl_get_last_error(ovnsb_idl);
+            VLOG_ERR("%s: database connection failed (%s)",
+                    ovnsb_db, ovs_retval_to_string(retval));
+            res = EXIT_FAILURE;
+            break;
+        }
+
+        if (ovnnb_seqno != ovsdb_idl_get_seqno(ovnnb_idl)) {
+            ovnnb_seqno = ovsdb_idl_get_seqno(ovnnb_idl);
+            ovnnb_changes_pending = true;
+        }
+
+        if (ovn_seqno != ovsdb_idl_get_seqno(ovnsb_idl)) {
+            ovn_seqno = ovsdb_idl_get_seqno(ovnsb_idl);
+            ovn_changes_pending = true;
+        }
+
+        /*
+         * If there are any pending changes, we delay recalculating the
+         * necessary updates until after an existing transaction finishes.
+         * This avoids the possibility of rapid updates causing ovn-northd to
+         * never be able to successfully make the corresponding updates to the
+         * other db.  Instead, pending changes are batched up until the next
+         * time we get a chance to calculate the new state and apply it.
+         */
+
+        if (ovnnb_changes_pending && !ctx.ovnsb_txn) {
+            /*
+             * The OVN-nb db contents have changed, so create a transaction for
+             * updating the OVN-sb DB.
+             */
+            ctx.ovnsb_txn = ovsdb_idl_txn_create(ctx.ovnsb_idl);
+            ovsdb_idl_txn_add_comment(ctx.ovnsb_txn,
+                                      "ovn-northd: northbound db changed");
+            ovnnb_db_changed(&ctx);
+            ovnnb_changes_pending = false;
+        }
+
+        if (ovn_changes_pending && !ctx.ovnnb_txn) {
+            /*
+             * The OVN-sb db contents have changed, so create a transaction for
+             * updating the northbound DB.
+             */
+            ctx.ovnnb_txn = ovsdb_idl_txn_create(ctx.ovnnb_idl);
+            ovsdb_idl_txn_add_comment(ctx.ovnnb_txn,
+                                      "ovn-northd: southbound db changed");
+            ovnsb_db_changed(&ctx);
+            ovn_changes_pending = false;
+        }
+
+        if (ctx.ovnnb_txn) {
+            enum ovsdb_idl_txn_status txn_status;
+            txn_status = ovsdb_idl_txn_commit(ctx.ovnnb_txn);
+            switch (txn_status) {
+            case TXN_UNCOMMITTED:
+            case TXN_INCOMPLETE:
+                /* Come back around and try to commit this transaction again */
+                break;
+            case TXN_ABORTED:
+            case TXN_TRY_AGAIN:
+            case TXN_NOT_LOCKED:
+            case TXN_ERROR:
+                /* Something went wrong, so try creating a new transaction. */
+                ovn_changes_pending = true;
+            case TXN_UNCHANGED:
+            case TXN_SUCCESS:
+                ovsdb_idl_txn_destroy(ctx.ovnnb_txn);
+                ctx.ovnnb_txn = NULL;
+            }
+        }
+
+        if (ctx.ovnsb_txn) {
+            enum ovsdb_idl_txn_status txn_status;
+            txn_status = ovsdb_idl_txn_commit(ctx.ovnsb_txn);
+            switch (txn_status) {
+            case TXN_UNCOMMITTED:
+            case TXN_INCOMPLETE:
+                /* Come back around and try to commit this transaction again */
+                break;
+            case TXN_ABORTED:
+            case TXN_TRY_AGAIN:
+            case TXN_NOT_LOCKED:
+            case TXN_ERROR:
+                /* Something went wrong, so try creating a new transaction. */
+                ovnnb_changes_pending = true;
+            case TXN_UNCHANGED:
+            case TXN_SUCCESS:
+                ovsdb_idl_txn_destroy(ctx.ovnsb_txn);
+                ctx.ovnsb_txn = NULL;
+            }
+        }
+
+        if (ovnnb_seqno == ovsdb_idl_get_seqno(ovnnb_idl) &&
+                ovn_seqno == ovsdb_idl_get_seqno(ovnsb_idl)) {
+            ovsdb_idl_wait(ovnnb_idl);
+            ovsdb_idl_wait(ovnsb_idl);
+            if (ctx.ovnnb_txn) {
+                ovsdb_idl_txn_wait(ctx.ovnnb_txn);
+            }
+            if (ctx.ovnsb_txn) {
+                ovsdb_idl_txn_wait(ctx.ovnsb_txn);
+            }
+            poll_block();
+        }
+    }
+
+    ovsdb_idl_destroy(ovnsb_idl);
+    ovsdb_idl_destroy(ovnnb_idl);
+
+    exit(res);
+}
diff --git a/ovn/ovn-architecture.7.xml b/ovn/ovn-architecture.7.xml
index 69a8874..9ed162b 100644
--- a/ovn/ovn-architecture.7.xml
+++ b/ovn/ovn-architecture.7.xml
@@ -103,13 +103,13 @@
 
       <p>
 	The OVN Northbound Database has only two clients: the OVN/CMS Plugin
-	above it and <code>ovn-nbd</code> below it.
+	above it and <code>ovn-northd</code> below it.
       </p>
     </li>
 
     <li>
-      <code>ovn-nbd</code>(8) connects to the OVN Northbound Database above it
-      and the OVN Southbound Database below it.  It translates the
+      <code>ovn-northd</code>(8) connects to the OVN Northbound Database
+      above it and the OVN Southbound Database below it.  It translates the
       logical network configuration in terms of conventional network
       concepts, taken from the OVN Northbound Database, into logical
       datapath flows in the OVN Southbound Database below it.
@@ -118,7 +118,7 @@
     <li>
       <p>
     The <dfn>OVN Southbound Database</dfn> is the center of the system.
-    Its clients are <code>ovn-nbd</code>(8) above it and
+    Its clients are <code>ovn-northd</code>(8) above it and
     <code>ovn-controller</code>(8) on every transport node below it.
       </p>
 
@@ -129,7 +129,7 @@
 	logical network in terms of ``logical datapath flows,'' and
 	<dfn>Binding</dfn> tables that link logical network components'
 	locations to the physical network.  The hypervisors populate the PN and
-	Binding tables, whereas <code>ovn-nbd</code>(8) populates the LN
+	Binding tables, whereas <code>ovn-northd</code>(8) populates the LN
 	tables.
       </p>
 
@@ -177,7 +177,7 @@
                        |   OVN Northbound DB   |
                        |           |           |
                        |           |           |
-                       |        ovn-nbd        |
+                       |       ovn-northd      |
                        |           |           |
                        +-----------|-----------+
                                    |
@@ -292,7 +292,7 @@
     </li>
 
     <li>
-      <code>ovn-nbd</code> receives the OVN Northbound database update.
+      <code>ovn-northd</code> receives the OVN Northbound database update.
       In turn, it makes the corresponding updates to the OVN Southbound
       database, by adding rows to the OVN Southbound database
       <code>Pipeline</code> table to reflect the new port, e.g. add a
@@ -306,8 +306,8 @@
 
     <li>
       On every hypervisor, <code>ovn-controller</code> receives the
-      <code>Pipeline</code> table updates that <code>ovn-nbd</code> made in the
-      previous step.  As long as the VM that owns the VIF is powered off,
+      <code>Pipeline</code> table updates that <code>ovn-northd</code> made
+      in the previous step.  As long as the VM that owns the VIF is powered off,
       <code>ovn-controller</code> cannot do much; it cannot, for example,
       arrange to send packets to or receive packets from the VIF, because the
       VIF does not actually exist anywhere.
@@ -337,12 +337,13 @@
 
     <li>
       Some CMS systems, including OpenStack, fully start a VM only when its
-      networking is ready.  To support this, <code>ovn-nbd</code> notices the
-      <code>chassis</code> column updated for the row in <code>Bindings</code>
-      table and pushes this upward by updating the <ref column="up"
-      table="Logical_Port" db="OVN_NB"/> column in the OVN Northbound
-      database's <ref table="Logical_Port" db="OVN_NB"/> table to indicate
-      that the VIF is now up.  The CMS, if it uses this feature, can then
+      networking is ready.  To support this, <code>ovn-northd</code> notices
+      the <code>chassis</code> column updated for the row in
+      <code>Bindings</code> table and pushes this upward by updating the
+      <ref column="up" table="Logical_Port" db="OVN_NB"/> column in the OVN
+      Northbound database's <ref table="Logical_Port" db="OVN_NB"/> table to
+      indicate that the VIF is now up.  The CMS, if it uses this feature, can
+      then
       react by allowing the VM's execution to proceed.
     </li>
 
@@ -389,7 +390,7 @@
     </li>
 
     <li>
-      <code>ovn-nbd</code> receives the OVN Northbound update and in turn
+      <code>ovn-northd</code> receives the OVN Northbound update and in turn
       updates the OVN Southbound database accordingly, by removing or
       updating the rows from the OVN Southbound database
       <code>Pipeline</code> table and <code>Bindings</code> table that
@@ -398,9 +399,9 @@
 
     <li>
       On every hypervisor, <code>ovn-controller</code> receives the
-      <code>Pipeline</code> table updates that <code>ovn-nbd</code> made in the
-      previous step.  <code>ovn-controller</code> updates OpenFlow tables to
-      reflect the update, although there may not be much to do, since the VIF
+      <code>Pipeline</code> table updates that <code>ovn-northd</code> made
+      in the previous step.  <code>ovn-controller</code> updates OpenFlow tables
+      to reflect the update, although there may not be much to do, since the VIF
       had already become unreachable when it was removed from the
       <code>Bindings</code> table in a previous step.
     </li>
@@ -486,8 +487,8 @@
     </li>
 
     <li>
-      <code>ovn-nbd</code> receives the OVN Northbound database update.  In
-      turn, it makes the corresponding updates to the OVN Southbound
+      <code>ovn-northd</code> receives the OVN Northbound database update.
+      In turn, it makes the corresponding updates to the OVN Southbound
       database, by adding rows to the OVN Southbound database's
       <code>Pipeline</code> table to reflect the new port and also by
       creating a new row in the <code>Bindings</code> table and
@@ -498,10 +499,11 @@
     <li>
       On every hypervisor, <code>ovn-controller</code> subscribes to the
       changes in the <code>Bindings</code> table.  When a new row is created
-      by <code>ovn-nbd</code> that includes a value in <code>parent_port</code>
-      column of <code>Bindings</code> table, the <code>ovn-controller</code>
-      in the hypervisor whose OVN integration bridge has that same value in
-      <var>vif-id</var> in <code>external-ids</code>:<code>iface-id</code>
+      by <code>ovn-northd</code> that includes a value in
+      <code>parent_port</code> column of <code>Bindings</code> table, the
+      <code>ovn-controller</code> in the hypervisor whose OVN integration bridge
+      has that same value in <var>vif-id</var> in
+      <code>external-ids</code>:<code>iface-id</code>
       updates the local hypervisor's OpenFlow tables so that packets to and
       from the VIF with the particular VLAN <code>tag</code> are properly
       handled.  Afterward it updates the <code>chassis</code> column of
@@ -510,7 +512,7 @@
 
     <li>
       One can only start the application inside the container after the
-      underlying network is ready.  To support this, <code>ovn-nbd</code>
+      underlying network is ready.  To support this, <code>ovn-northd</code>
       notices the updated <code>chassis</code> column in <code>Bindings</code>
       table and updates the <ref column="up" table="Logical_Port"
       db="OVN_NB"/> column in the OVN Northbound database's
@@ -526,7 +528,7 @@
     </li>
 
     <li>
-      <code>ovn-nbd</code> receives the OVN Northbound update and in turn
+      <code>ovn-northd</code> receives the OVN Northbound update and in turn
       updates the OVN Southbound database accordingly, by removing or
       updating the rows from the OVN Southbound database
       <code>Pipeline</code> table that were related to the now-destroyed
@@ -536,9 +538,9 @@
 
     <li>
       On every hypervisor, <code>ovn-controller</code> receives the
-      <code>Pipeline</code> table updates that <code>ovn-nbd</code> made in the
-      previous step.  <code>ovn-controller</code> updates OpenFlow tables to
-      reflect the update.
+      <code>Pipeline</code> table updates that <code>ovn-northd</code> made
+      in the previous step.  <code>ovn-controller</code> updates OpenFlow tables
+      to reflect the update.
     </li>
   </ol>
 </manpage>
diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml
index 14ee117..2d0632e 100644
--- a/ovn/ovn-nb.xml
+++ b/ovn/ovn-nb.xml
@@ -3,8 +3,8 @@
   <p>
     This database is the interface between OVN and the cloud management system
     (CMS), such as OpenStack, running above it.  The CMS produces almost all of
-    the contents of the database.  The <code>ovn-nbd</code> program monitors
-    the database contents, transforms it, and stores it into the <ref
+    the contents of the database.  The <code>ovn-northd</code> program
+    monitors the database contents, transforms it, and stores it into the <ref
     db="OVN_Southbound"/> database.
   </p>
 
@@ -116,10 +116,10 @@
     </column>
 
     <column name="up">
-      This column is populated by <code>ovn-nbd</code>, rather than by the CMS
-      plugin as is most of this database.  When a logical port is bound
+      This column is populated by <code>ovn-northd</code>, rather than by
+      the CMS plugin as is most of this database.  When a logical port is bound
       to a physical location in the OVN Southbound database <ref
-      db="OVN_Southbound" table="Bindings"/> table, <code>ovn-nbd</code>
+      db="OVN_Southbound" table="Bindings"/> table, <code>ovn-northd</code>
       sets this column to <code>true</code>; otherwise, or if the port
       becomes unbound later, it sets it to <code>false</code>.  This
       allows the CMS to wait for a VM's (or container's) networking to
diff --git a/ovn/ovn-nbd.c b/ovn/ovn-nbd.c
deleted file mode 100644
index 27e90c6..0000000
--- a/ovn/ovn-nbd.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <config.h>
-
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "command-line.h"
-#include "daemon.h"
-#include "dirs.h"
-#include "fatal-signal.h"
-#include "hash.h"
-#include "hmap.h"
-#include "ovn/ovn-nb-idl.h"
-#include "ovn/ovn-sb-idl.h"
-#include "poll-loop.h"
-#include "stream.h"
-#include "stream-ssl.h"
-#include "util.h"
-#include "uuid.h"
-#include "openvswitch/vlog.h"
-
-VLOG_DEFINE_THIS_MODULE(ovn_nbd);
-
-struct nbd_context {
-    struct ovsdb_idl *ovnnb_idl;
-    struct ovsdb_idl *ovnsb_idl;
-    struct ovsdb_idl_txn *ovnnb_txn;
-    struct ovsdb_idl_txn *ovnsb_txn;
-};
-
-static const char *ovnnb_db;
-static const char *ovnsb_db;
-
-static const char *default_db(void);
-
-static void
-usage(void)
-{
-    printf("\
-%s: OVN northbound management daemon\n\
-usage: %s [OPTIONS]\n\
-\n\
-Options:\n\
-  --ovnnb-db=DATABASE       connect to ovn-nb database at DATABASE\n\
-                            (default: %s)\n\
-  --ovnsb-db=DATABASE       connect to ovn-sb database at DATABASE\n\
-                            (default: %s)\n\
-  -h, --help                display this help message\n\
-  -o, --options             list available options\n\
-  -V, --version             display version information\n\
-", program_name, program_name, default_db(), default_db());
-    daemon_usage();
-    vlog_usage();
-    stream_usage("database", true, true, false);
-}
-
-static int
-compare_strings(const void *a_, const void *b_)
-{
-    char *const *a = a_;
-    char *const *b = b_;
-    return strcmp(*a, *b);
-}
-
-/*
- * Determine whether 2 arrays of MAC addresses are the same.  It's possible that
- * the lists could be *very* long and this check is being done a lot (every
- * time the OVN_Northbound database changes).
- */
-static bool
-macs_equal(char **binding_macs_, size_t b_n_macs,
-           char **lport_macs_, size_t l_n_macs)
-{
-    char **binding_macs, **lport_macs;
-    size_t bytes, i;
-
-    if (b_n_macs != l_n_macs) {
-        return false;
-    }
-
-    bytes = b_n_macs * sizeof binding_macs_[0];
-    binding_macs = xmalloc(bytes);
-    lport_macs = xmalloc(bytes);
-
-    memcpy(binding_macs, binding_macs_, bytes);
-    memcpy(lport_macs, lport_macs_, bytes);
-
-    qsort(binding_macs, b_n_macs, sizeof binding_macs[0], compare_strings);
-    qsort(lport_macs, l_n_macs, sizeof lport_macs[0], compare_strings);
-
-    for (i = 0; i < b_n_macs; i++) {
-        if (strcmp(binding_macs[i], lport_macs[i])) {
-            break;
-        }
-    }
-
-    free(binding_macs);
-    free(lport_macs);
-
-    return (i == b_n_macs) ? true : false;
-}
-
-/*
- * When a change has occurred in the OVN_Northbound database, we go through and
- * make sure that the contents of the Bindings table in the OVN_Southbound
- * database are up to date with the logical ports defined in the
- * OVN_Northbound database.
- */
-static void
-set_bindings(struct nbd_context *ctx)
-{
-    struct hmap bindings_hmap;
-    const struct sbrec_bindings *binding;
-    const struct nbrec_logical_port *lport;
-
-    struct binding_hash_node {
-        struct hmap_node node;
-        const struct sbrec_bindings *binding;
-    } *hash_node, *hash_node_next;
-
-    /*
-     * We will need to look up a binding for every logical port.  We don't want
-     * to have to do an O(n) search for every binding, so start out by hashing
-     * them on the logical port.
-     *
-     * As we go through every logical port, we will update the binding if it
-     * exists or create one otherwise.  When the update is done, we'll remove it
-     * from the hashmap.  At the end, any bindings left in the hashmap are for
-     * logical ports that have been deleted.
-     */
-    hmap_init(&bindings_hmap);
-
-    SBREC_BINDINGS_FOR_EACH(binding, ctx->ovnsb_idl) {
-        hash_node = xzalloc(sizeof *hash_node);
-        hash_node->binding = binding;
-        hmap_insert(&bindings_hmap, &hash_node->node,
-                hash_string(binding->logical_port, 0));
-    }
-
-    NBREC_LOGICAL_PORT_FOR_EACH(lport, ctx->ovnnb_idl) {
-        binding = NULL;
-        HMAP_FOR_EACH_WITH_HASH(hash_node, node,
-                hash_string(lport->name, 0), &bindings_hmap) {
-            if (!strcmp(lport->name, hash_node->binding->logical_port)) {
-                binding = hash_node->binding;
-                break;
-            }
-        }
-
-        if (binding) {
-            /* We found an existing binding for this logical port.  Update its
-             * contents.  Right now the only thing we expect that could change
-             * is the list of MAC addresses. */
-
-            hmap_remove(&bindings_hmap, &hash_node->node);
-            free(hash_node);
-            hash_node = NULL;
-
-            if (!macs_equal(binding->mac, binding->n_mac,
-                        lport->macs, lport->n_macs)) {
-                sbrec_bindings_set_mac(binding,
-                        (const char **) lport->macs, lport->n_macs);
-            }
-        } else {
-            /* There is no binding for this logical port, so create one. */
-
-            binding = sbrec_bindings_insert(ctx->ovnsb_txn);
-            sbrec_bindings_set_logical_port(binding, lport->name);
-            sbrec_bindings_set_mac(binding,
-                    (const char **) lport->macs, lport->n_macs);
-        }
-    }
-
-    HMAP_FOR_EACH_SAFE(hash_node, hash_node_next, node, &bindings_hmap) {
-        hmap_remove(&bindings_hmap, &hash_node->node);
-        sbrec_bindings_delete(hash_node->binding);
-        free(hash_node);
-    }
-    hmap_destroy(&bindings_hmap);
-}
-
-static void
-ovnnb_db_changed(struct nbd_context *ctx)
-{
-    VLOG_DBG("ovn-nbd: ovn-nb db contents have changed.\n");
-
-    set_bindings(ctx);
-}
-
-/*
- * The only change we get notified about is if the 'chassis' column of the
- * 'Bindings' table changes.  When this column is not empty, it means we need to
- * set the corresponding logical port as 'up' in the northbound DB.
- */
-static void
-ovnsb_db_changed(struct nbd_context *ctx)
-{
-    struct hmap lports_hmap;
-    const struct sbrec_bindings *binding;
-    const struct nbrec_logical_port *lport;
-
-    struct lport_hash_node {
-        struct hmap_node node;
-        const struct nbrec_logical_port *lport;
-    } *hash_node, *hash_node_next;
-
-    VLOG_DBG("Recalculating port up states for ovn-nb db.");
-
-    hmap_init(&lports_hmap);
-
-    NBREC_LOGICAL_PORT_FOR_EACH(lport, ctx->ovnnb_idl) {
-        hash_node = xzalloc(sizeof *hash_node);
-        hash_node->lport = lport;
-        hmap_insert(&lports_hmap, &hash_node->node,
-                hash_string(lport->name, 0));
-    }
-
-    SBREC_BINDINGS_FOR_EACH(binding, ctx->ovnsb_idl) {
-        lport = NULL;
-        HMAP_FOR_EACH_WITH_HASH(hash_node, node,
-                hash_string(binding->logical_port, 0), &lports_hmap) {
-            if (!strcmp(binding->logical_port, hash_node->lport->name)) {
-                lport = hash_node->lport;
-                break;
-            }
-        }
-
-        if (!lport) {
-            /* The logical port doesn't exist for this binding.  This can happen
-             * under normal circumstances when ovn-nbd hasn't gotten around to
-             * pruning the Binding yet. */
-            continue;
-        }
-
-        if (*binding->chassis && (!lport->up || !*lport->up)) {
-            bool up = true;
-            nbrec_logical_port_set_up(lport, &up, 1);
-        } else if (!*binding->chassis && (!lport->up || *lport->up)) {
-            bool up = false;
-            nbrec_logical_port_set_up(lport, &up, 1);
-        }
-    }
-
-    HMAP_FOR_EACH_SAFE(hash_node, hash_node_next, node, &lports_hmap) {
-        hmap_remove(&lports_hmap, &hash_node->node);
-        free(hash_node);
-    }
-    hmap_destroy(&lports_hmap);
-}
-
-static const char *
-default_db(void)
-{
-    static char *def;
-    if (!def) {
-        def = xasprintf("unix:%s/db.sock", ovs_rundir());
-    }
-    return def;
-}
-
-static void
-parse_options(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
-{
-    enum {
-        DAEMON_OPTION_ENUMS,
-        VLOG_OPTION_ENUMS,
-    };
-    static const struct option long_options[] = {
-        {"ovnsb-db", required_argument, NULL, 'd'},
-        {"ovnnb-db", required_argument, NULL, 'D'},
-        {"help", no_argument, NULL, 'h'},
-        {"options", no_argument, NULL, 'o'},
-        {"version", no_argument, NULL, 'V'},
-        DAEMON_LONG_OPTIONS,
-        VLOG_LONG_OPTIONS,
-        STREAM_SSL_LONG_OPTIONS,
-        {NULL, 0, NULL, 0},
-    };
-    char *short_options = ovs_cmdl_long_options_to_short_options(long_options);
-
-    for (;;) {
-        int c;
-
-        c = getopt_long(argc, argv, short_options, long_options, NULL);
-        if (c == -1) {
-            break;
-        }
-
-        switch (c) {
-        DAEMON_OPTION_HANDLERS;
-        VLOG_OPTION_HANDLERS;
-        STREAM_SSL_OPTION_HANDLERS;
-
-        case 'd':
-            ovnsb_db = optarg;
-            break;
-
-        case 'D':
-            ovnnb_db = optarg;
-            break;
-
-        case 'h':
-            usage();
-            exit(EXIT_SUCCESS);
-
-        case 'o':
-            ovs_cmdl_print_options(long_options);
-            exit(EXIT_SUCCESS);
-
-        case 'V':
-            ovs_print_version(0, 0);
-            exit(EXIT_SUCCESS);
-
-        default:
-            break;
-        }
-    }
-
-    if (!ovnsb_db) {
-        ovnsb_db = default_db();
-    }
-
-    if (!ovnnb_db) {
-        ovnnb_db = default_db();
-    }
-
-    free(short_options);
-}
-
-int
-main(int argc, char *argv[])
-{
-    extern struct vlog_module VLM_reconnect;
-    struct ovsdb_idl *ovnnb_idl, *ovnsb_idl;
-    unsigned int ovnnb_seqno, ovn_seqno;
-    int res = EXIT_SUCCESS;
-    struct nbd_context ctx = {
-        .ovnsb_txn = NULL,
-    };
-    bool ovnnb_changes_pending = false;
-    bool ovn_changes_pending = false;
-
-    fatal_ignore_sigpipe();
-    set_program_name(argv[0]);
-    vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
-    vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_WARN);
-    parse_options(argc, argv);
-
-    daemonize();
-
-    nbrec_init();
-    sbrec_init();
-
-    /* We want to detect all changes to the ovn-nb db. */
-    ctx.ovnnb_idl = ovnnb_idl = ovsdb_idl_create(ovnnb_db,
-            &nbrec_idl_class, true, true);
-
-    /* There is only a small subset of changes to the ovn-sb db that ovn-nbd
-     * has to care about, so we'll enable monitoring those directly. */
-    ctx.ovnsb_idl = ovnsb_idl = ovsdb_idl_create(ovnsb_db,
-            &sbrec_idl_class, false, true);
-    ovsdb_idl_add_table(ovnsb_idl, &sbrec_table_bindings);
-    ovsdb_idl_add_column(ovnsb_idl, &sbrec_bindings_col_logical_port);
-    ovsdb_idl_add_column(ovnsb_idl, &sbrec_bindings_col_chassis);
-    ovsdb_idl_add_column(ovnsb_idl, &sbrec_bindings_col_mac);
-
-    /*
-     * The loop here just runs the IDL in a loop waiting for the seqno to
-     * change, which indicates that the contents of the db have changed.
-     *
-     * If the contents of the ovn-nb db change, the mappings to the ovn-sb
-     * db must be recalculated.
-     *
-     * If the contents of the ovn-sb db change, it means the 'up' state of
-     * a port may have changed, as that's the only type of change ovn-nbd is
-     * watching for.
-     */
-
-    ovnnb_seqno = ovsdb_idl_get_seqno(ovnnb_idl);
-    ovn_seqno = ovsdb_idl_get_seqno(ovnsb_idl);
-    for (;;) {
-        ovsdb_idl_run(ovnnb_idl);
-        ovsdb_idl_run(ovnsb_idl);
-
-        if (!ovsdb_idl_is_alive(ovnnb_idl)) {
-            int retval = ovsdb_idl_get_last_error(ovnnb_idl);
-            VLOG_ERR("%s: database connection failed (%s)",
-                    ovnnb_db, ovs_retval_to_string(retval));
-            res = EXIT_FAILURE;
-            break;
-        }
-
-        if (!ovsdb_idl_is_alive(ovnsb_idl)) {
-            int retval = ovsdb_idl_get_last_error(ovnsb_idl);
-            VLOG_ERR("%s: database connection failed (%s)",
-                    ovnsb_db, ovs_retval_to_string(retval));
-            res = EXIT_FAILURE;
-            break;
-        }
-
-        if (ovnnb_seqno != ovsdb_idl_get_seqno(ovnnb_idl)) {
-            ovnnb_seqno = ovsdb_idl_get_seqno(ovnnb_idl);
-            ovnnb_changes_pending = true;
-        }
-
-        if (ovn_seqno != ovsdb_idl_get_seqno(ovnsb_idl)) {
-            ovn_seqno = ovsdb_idl_get_seqno(ovnsb_idl);
-            ovn_changes_pending = true;
-        }
-
-        /*
-         * If there are any pending changes, we delay recalculating the
-         * necessary updates until after an existing transaction finishes.
-         * This avoids the possibility of rapid updates causing ovn-nbd to never
-         * be able to successfully make the corresponding updates to the other
-         * db.  Instead, pending changes are batched up until the next time we
-         * get a chance to calculate the new state and apply it.
-         */
-
-        if (ovnnb_changes_pending && !ctx.ovnsb_txn) {
-            /*
-             * The OVN-nb db contents have changed, so create a transaction for
-             * updating the OVN-sb DB.
-             */
-            ctx.ovnsb_txn = ovsdb_idl_txn_create(ctx.ovnsb_idl);
-            ovsdb_idl_txn_add_comment(ctx.ovnsb_txn,
-                                      "ovn-nbd: northbound db changed");
-            ovnnb_db_changed(&ctx);
-            ovnnb_changes_pending = false;
-        }
-
-        if (ovn_changes_pending && !ctx.ovnnb_txn) {
-            /*
-             * The OVN-sb db contents have changed, so create a transaction for
-             * updating the northbound DB.
-             */
-            ctx.ovnnb_txn = ovsdb_idl_txn_create(ctx.ovnnb_idl);
-            ovsdb_idl_txn_add_comment(ctx.ovnnb_txn,
-                                      "ovn-nbd: southbound db changed");
-            ovnsb_db_changed(&ctx);
-            ovn_changes_pending = false;
-        }
-
-        if (ctx.ovnnb_txn) {
-            enum ovsdb_idl_txn_status txn_status;
-            txn_status = ovsdb_idl_txn_commit(ctx.ovnnb_txn);
-            switch (txn_status) {
-            case TXN_UNCOMMITTED:
-            case TXN_INCOMPLETE:
-                /* Come back around and try to commit this transaction again */
-                break;
-            case TXN_ABORTED:
-            case TXN_TRY_AGAIN:
-            case TXN_NOT_LOCKED:
-            case TXN_ERROR:
-                /* Something went wrong, so try creating a new transaction. */
-                ovn_changes_pending = true;
-            case TXN_UNCHANGED:
-            case TXN_SUCCESS:
-                ovsdb_idl_txn_destroy(ctx.ovnnb_txn);
-                ctx.ovnnb_txn = NULL;
-            }
-        }
-
-        if (ctx.ovnsb_txn) {
-            enum ovsdb_idl_txn_status txn_status;
-            txn_status = ovsdb_idl_txn_commit(ctx.ovnsb_txn);
-            switch (txn_status) {
-            case TXN_UNCOMMITTED:
-            case TXN_INCOMPLETE:
-                /* Come back around and try to commit this transaction again */
-                break;
-            case TXN_ABORTED:
-            case TXN_TRY_AGAIN:
-            case TXN_NOT_LOCKED:
-            case TXN_ERROR:
-                /* Something went wrong, so try creating a new transaction. */
-                ovnnb_changes_pending = true;
-            case TXN_UNCHANGED:
-            case TXN_SUCCESS:
-                ovsdb_idl_txn_destroy(ctx.ovnsb_txn);
-                ctx.ovnsb_txn = NULL;
-            }
-        }
-
-        if (ovnnb_seqno == ovsdb_idl_get_seqno(ovnnb_idl) &&
-                ovn_seqno == ovsdb_idl_get_seqno(ovnsb_idl)) {
-            ovsdb_idl_wait(ovnnb_idl);
-            ovsdb_idl_wait(ovnsb_idl);
-            if (ctx.ovnnb_txn) {
-                ovsdb_idl_txn_wait(ctx.ovnnb_txn);
-            }
-            if (ctx.ovnsb_txn) {
-                ovsdb_idl_txn_wait(ctx.ovnsb_txn);
-            }
-            poll_block();
-        }
-    }
-
-    ovsdb_idl_destroy(ovnsb_idl);
-    ovsdb_idl_destroy(ovnnb_idl);
-
-    exit(res);
-}
diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml
index 2c6017b..e4159db 100644
--- a/ovn/ovn-sb.xml
+++ b/ovn/ovn-sb.xml
@@ -11,7 +11,7 @@
     architecture.  It is the one component that speaks both southbound
     directly to all the hypervisors and gateways, via
     <code>ovn-controller</code>, and northbound to the Cloud Management
-    System, via <code>ovn-nbd</code>:
+    System, via <code>ovn-northd</code>:
   </p>
 
   <h2>Database Structure</h2>
@@ -64,7 +64,7 @@
     That CMS determines the entire OVN logical configuration and therefore the
     LN's content at any given time is a deterministic function of the CMS's
     configuration, although that happens indirectly via the OVN Northbound DB
-    and <code>ovn-nbd</code>.
+    and <code>ovn-northd</code>.
   </p>
 
   <p>
@@ -629,8 +629,8 @@
 
     <p>
       For every <code>Logical_Port</code> record in <code>OVN_Northbound</code>
-      database, <code>ovn-nbd</code> creates a record in this table.
-      <code>ovn-nbd</code> populates and maintains every column except
+      database, <code>ovn-northd</code> creates a record in this table.
+      <code>ovn-northd</code> populates and maintains every column except
       the <code>chassis</code> column, which it leaves empty in new records.
     </p>
 
diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox
index 133585e..8aa2ddd 100755
--- a/tutorial/ovs-sandbox
+++ b/tutorial/ovs-sandbox
@@ -44,7 +44,7 @@ rungdb() {
 
 gdb_vswitchd=false
 gdb_ovsdb=false
-gdb_ovn_nbd=false
+gdb_ovn_northd=false
 gdb_ovn_controller=false
 builddir=
 srcdir=
@@ -94,7 +94,7 @@ These options force ovs-sandbox to use an installed Open vSwitch:
   -i, --installed      use installed Open vSwitch
   -g, --gdb-vswitchd   run ovs-vswitchd under gdb
   -d, --gdb-ovsdb      run ovsdb-server under gdb
-  --gdb-ovn-nbd        run ovn-nbd under gdb
+  --gdb-ovn-northd     run ovn-northd under gdb
   --gdb-ovn-controller run ovn-controller under gdb
   -S, --schema=FILE    use FILE as vswitch.ovsschema
   -o, --ovn            enable OVN
@@ -138,8 +138,8 @@ EOF
         -d|--gdb-ovsdb)
             gdb_ovsdb=true
             ;;
-        --gdb-ovn-nbd)
-            gdb_ovn_nbd=true
+        --gdb-ovn-northd)
+            gdb_ovn_northd=true
             ;;
         --gdb-ovn-controller)
             gdb_ovn_controller=true
@@ -217,7 +217,7 @@ if $built; then
     fi
     PATH=$builddir/ovsdb:$builddir/vswitchd:$builddir/utilities:$PATH
     if $ovn; then
-        PATH=$builddir/ovn:$builddir/ovn/controller:$PATH
+        PATH=$builddir/ovn:$builddir/ovn/controller:$builddir/ovn/northd:$PATH
     fi
     export PATH
 else
@@ -293,7 +293,7 @@ if $ovn; then
     ovs-vsctl set open . external-ids:ovn-encap-ip=127.0.0.1
     ovs-vsctl add-br br-int
 
-    rungdb $gdb_ovn_nbd ovn-nbd --detach --no-chdir --pidfile -vconsole:off --log-file
+    rungdb $gdb_ovn_northd ovn-northd --detach --no-chdir --pidfile -vconsole:off --log-file
     rungdb $gdb_ovn_controller ovn-controller --detach --no-chdir --pidfile -vconsole:off --log-file
 fi
 
-- 
2.1.0




More information about the dev mailing list