From: Numan Siddique <[email protected]>

This patch adds the following functions
  - start_nb_ovsdb, stop_nb_ovsdb, restart_nb_ovsdb to start, stop and
    restart the OVN NB DB ovsdb-server independently.
  - start_sb_ovsdb, stop_sb_ovsdb, restart_sb_ovsdb to start, stop and
    restart the OVN SB DB ovsdb-server independently.

These commands can be used to run ovsdb-server for each DB in a separate
container.

Signed-off-by: Numan Siddique <[email protected]>
---
 ovn/utilities/ovn-ctl | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index bff09b6..6fff6e4 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -38,16 +38,23 @@ pidfile_is_running () {
     test -e "$pidfile" && pid=`cat "$pidfile"` && pid_exists "$pid"
 } >/dev/null 2>&1
 
-stop_ovsdb () {
+stop_nb_ovsdb() {
     if pidfile_is_running $DB_NB_PID; then
         ovs-appctl -t $rundir/ovnnb_db.ctl exit
     fi
+}
 
+stop_sb_ovsdb() {
     if pidfile_is_running $DB_SB_PID; then
         ovs-appctl -t $rundir/ovnsb_db.ctl exit
     fi
 }
 
+stop_ovsdb () {
+    stop_nb_ovsdb
+    stop_sb_ovsdb
+}
+
 demote_ovnnb() {
     if test ! -z "$DB_NB_SYNC_FROM_ADDR"; then
         echo 
"$DB_NB_SYNC_FROM_PROTO:$DB_NB_SYNC_FROM_ADDR:$DB_NB_SYNC_FROM_PORT" > 
$ovnnb_active_conf_file
@@ -86,7 +93,7 @@ promote_ovnsb() {
     ovs-appctl -t $rundir/ovnsb_db.ctl 
ovsdb-server/disconnect-active-ovsdb-server
 }
 
-start_ovsdb () {
+start_nb_ovsdb() {
     # Check and eventually start ovsdb-server for Northbound DB
     if ! pidfile_is_running $DB_NB_PID; then
         upgrade_db "$DB_NB_FILE" "$DB_NB_SCHEMA" 1>/dev/null 2>/dev/null
@@ -117,7 +124,9 @@ start_ovsdb () {
         $@ $DB_NB_FILE
         ovn-nbctl init
     fi
+}
 
+start_sb_ovsdb() {
     # Check and eventually start ovsdb-server for Southbound DB
     if ! pidfile_is_running $DB_SB_PID; then
         upgrade_db "$DB_SB_FILE" "$DB_SB_SCHEMA" 1>/dev/null 2>/dev/null
@@ -150,6 +159,11 @@ start_ovsdb () {
     fi
 }
 
+start_ovsdb () {
+    start_nb_ovsdb
+    start_sb_ovsdb
+}
+
 sync_status() {
     ovs-appctl -t $rundir/ovn${1}_db.ctl ovsdb-server/sync-status | awk 
'{if(NR==1) print $2}'
 }
@@ -299,6 +313,16 @@ restart_ovsdb () {
     start_ovsdb
 }
 
+restart_nb_ovsdb () {
+    stop_nb_ovsdb
+    start_nb_ovsdb
+}
+
+restart_sb_ovsdb () {
+    stop_sb_ovsdb
+    start_sb_ovsdb
+}
+
 ## ---- ##
 ## main ##
 ## ---- ##
@@ -380,14 +404,20 @@ startup scripts.  System administrators should not 
normally invoke it directly.
 Commands:
   start_northd                start ovn-northd
   start_ovsdb                 start ovn related ovsdb-server processes
+  start_nb_ovsdb              start ovn northbound db ovsdb-server process
+  start_sb_ovsdb              start ovn southbound db ovsdb-server process
   start_controller            start ovn-controller
   start_controller_vtep       start ovn-controller-vtep
   stop_northd                 stop ovn-northd
   stop_ovsdb                  stop ovn related ovsdb-server processes
+  stop_nb_ovsdb               stop ovn northbound db ovsdb-server process
+  stop_sb_ovsdb               stop ovn southbound db ovsdb-server process
   stop_controller             stop ovn-controller
   stop_controller_vtep        stop ovn-controller-vtep
   restart_northd              restart ovn-northd
   restart_ovsdb               restart ovn related ovsdb-server processes
+  restart_nb_ovsdb            restart ovn northbound db ovsdb-server process
+  restart_sb_ovsdb            restart ovn southbound db ovsdb-server process
   restart_controller          restart ovn-controller
   restart_controller_vtep     restart ovn-controller-vtep
 
@@ -493,6 +523,12 @@ case $command in
     start_ovsdb)
         start_ovsdb
         ;;
+    start_nb_ovsdb)
+        start_nb_ovsdb
+        ;;
+    start_sb_ovsdb)
+        start_sb_ovsdb
+        ;;
     start_controller)
         start_controller
         ;;
@@ -505,6 +541,12 @@ case $command in
     stop_ovsdb)
        stop_ovsdb
         ;;
+    stop_nb_ovsdb)
+       stop_nb_ovsdb
+        ;;
+    stop_sb_ovsdb)
+       stop_sb_ovsdb
+        ;;
     stop_controller)
         stop_controller
         ;;
@@ -520,6 +562,12 @@ case $command in
     restart_ovsdb)
         restart_ovsdb
         ;;
+    restart_nb_ovsdb)
+        restart_nb_ovsdb
+        ;;
+    restart_sb_ovsdb)
+        restart_sb_ovsdb
+        ;;
     restart_controller)
         restart_controller
         ;;
-- 
2.9.3

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to