diff -Nru openvswitch-2.12.1~git20191107.7accd1302/debian/changelog openvswitch-2.12.1~git20191107.7accd1302/debian/changelog
--- openvswitch-2.12.1~git20191107.7accd1302/debian/changelog 2019-11-12 22:43:03.000000000 +0000
+++ openvswitch-2.12.1~git20191107.7accd1302/debian/changelog 2019-11-21 07:29:06.000000000 +0000
@@ -1,3 +1,9 @@
+openvswitch (2.12.1~git20191107.7accd1302-0ubuntu2) focal; urgency=medium
+
+ * d/p/northd-status.patch: Add `status` management command
+
+ -- Frode Nordahl status
+ You may run ovn-northd
more than once in an OVN deployment.
+- OVN will automatically ensure that only one of them is active at a time.
++ When connected to a standalone or clustered DB setup, OVN will
++ automatically ensure that only one of them is active at a time.
+ If multiple instances of ovn-northd
are running and the
+ active ovn-northd
fails, one of the hot standby instances
+ of ovn-northd
will automatically take over.
+diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
+index a5e711e69..a943e1037 100644
+--- a/ovn/northd/ovn-northd.c
++++ b/ovn/northd/ovn-northd.c
+@@ -55,6 +55,7 @@ static unixctl_cb_func ovn_northd_exit;
+ static unixctl_cb_func ovn_northd_pause;
+ static unixctl_cb_func ovn_northd_resume;
+ static unixctl_cb_func ovn_northd_is_paused;
++static unixctl_cb_func ovn_northd_status;
+
+ struct northd_context {
+ struct ovsdb_idl *ovnnb_idl;
+@@ -10843,6 +10844,7 @@ main(int argc, char *argv[])
+ int retval;
+ bool exiting;
+ bool paused;
++ bool had_lock;
+
+ fatal_ignore_sigpipe();
+ ovs_cmdl_proctitle_init(argc, argv);
+@@ -10868,6 +10870,7 @@ main(int argc, char *argv[])
+ unixctl_command_register("resume", "", 0, 0, ovn_northd_resume, &paused);
+ unixctl_command_register("is-paused", "", 0, 0, ovn_northd_is_paused,
+ &paused);
++ unixctl_command_register("status", "", 0, 0, ovn_northd_status, &had_lock);
+
+ daemonize_complete();
+
+@@ -11073,11 +11076,11 @@ main(int argc, char *argv[])
+ * acquiring a lock called "ovn_northd" on the southbound database
+ * and then only performing DB transactions if the lock is held. */
+ ovsdb_idl_set_lock(ovnsb_idl_loop.idl, "ovn_northd");
+- bool had_lock = false;
+
+ /* Main loop. */
+ exiting = false;
+ paused = false;
++ had_lock = false;
+ while (!exiting) {
+ if (!paused) {
+ struct northd_context ctx = {
+@@ -11185,3 +11188,18 @@ ovn_northd_is_paused(struct unixctl_conn *conn, int argc OVS_UNUSED,
+ unixctl_command_reply(conn, "false");
+ }
+ }
++
++static void
++ovn_northd_status(struct unixctl_conn *conn, int argc OVS_UNUSED,
++ const char *argv[] OVS_UNUSED, void *had_lock_)
++{
++ bool *had_lock = had_lock_;
++ /*
++ * Use a labelled formatted output so we can add more to the status command
++ * later without breaking any consuming scripts
++ */
++ struct ds s = DS_EMPTY_INITIALIZER;
++ ds_put_format(&s, "Status: %s\n", *had_lock ? "active" : "standby");
++ unixctl_command_reply(conn, ds_cstr(&s));
++ ds_destroy(&s);
++}
+diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
+index da566f900..c73fd9003 100644
+--- a/tests/ovn-northd.at
++++ b/tests/ovn-northd.at
+@@ -899,6 +899,15 @@ OVS_APP_EXIT_AND_WAIT([ovn-northd])
+
+ AT_CLEANUP
+
++AT_SETUP([ovn -- ovn-northd status])
++AT_SKIP_IF([test $HAVE_PYTHON = no])
++ovn_start
++
++AT_CHECK([as northd ovs-appctl -t ovn-northd status], [0], [Status: active
++])
++
++AT_CLEANUP
++
+ AT_SETUP([ovn -- ovn-northd pause and resume])
+ AT_SKIP_IF([test $HAVE_PYTHON = no])
+ ovn_start
diff -Nru openvswitch-2.12.1~git20191107.7accd1302/debian/patches/series openvswitch-2.12.1~git20191107.7accd1302/debian/patches/series
--- openvswitch-2.12.1~git20191107.7accd1302/debian/patches/series 2019-08-28 08:33:10.000000000 +0000
+++ openvswitch-2.12.1~git20191107.7accd1302/debian/patches/series 2019-11-21 07:28:57.000000000 +0000
@@ -1 +1,2 @@
py3-compat.patch
+northd-status.patch