diff mbox

[ovs-dev] ovn-ctl: Add commands to manage OVN DB ovsdb-servers individually

Message ID 20170525085551.5148-1-nusiddiq@redhat.com
State Accepted
Headers show

Commit Message

Numan Siddique May 25, 2017, 8:55 a.m. UTC
From: Numan Siddique <nusiddiq@redhat.com>

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 <nusiddiq@redhat.com>
---
 ovn/utilities/ovn-ctl | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 2 deletions(-)

Comments

Andy Zhou May 25, 2017, 10 p.m. UTC | #1
On Thu, May 25, 2017 at 1:55 AM,  <nusiddiq@redhat.com> wrote:
> From: Numan Siddique <nusiddiq@redhat.com>
>
> 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 <nusiddiq@redhat.com>

LGTM.
Acked-by: Andy Zhou <azhou@ovn.org>

What's the intended use cases for running ovsdb-servers in separate containers?
Where would northd run?
Numan Siddique May 26, 2017, 11:48 a.m. UTC | #2
On Fri, May 26, 2017 at 3:30 AM, Andy Zhou <azhou@ovn.org> wrote:

> On Thu, May 25, 2017 at 1:55 AM,  <nusiddiq@redhat.com> wrote:
> > From: Numan Siddique <nusiddiq@redhat.com>
> >
> > 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 <nusiddiq@redhat.com>
>
> LGTM.
> Acked-by: Andy Zhou <azhou@ovn.org>
>
> What's the intended use cases for running ovsdb-servers in separate
> containers?
> Where would northd run?
>


The Openstack kolla project [1], it generates a separate container image
for vswitchd and ovsdb-server.
The goal is to support kolla images for OVN. I have submitted the patch
here [2].
Based on the present approach taken in kolla for openvswitch, this patch
generates a separate container image for nb ovsdb-server, sb ovsdb-server,
ovn-northd and ovn-controller. the nb ovsdb-server, sb ovsdb-server and
ovn-northd is expected to be run in the same host (as separate containers).

[1] - https://github.com/openstack/kolla/tree/master/docker/openvswitch
[2] - https://review.openstack.org/#/c/459179/

Thanks
Numan
Andy Zhou May 26, 2017, 5:36 p.m. UTC | #3
On Fri, May 26, 2017 at 4:48 AM, Numan Siddique <nusiddiq@redhat.com> wrote:
>
>
> On Fri, May 26, 2017 at 3:30 AM, Andy Zhou <azhou@ovn.org> wrote:
>>
>> On Thu, May 25, 2017 at 1:55 AM,  <nusiddiq@redhat.com> wrote:
>> > From: Numan Siddique <nusiddiq@redhat.com>
>> >
>> > 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 <nusiddiq@redhat.com>
>>
>> LGTM.
>> Acked-by: Andy Zhou <azhou@ovn.org>
>>
>> What's the intended use cases for running ovsdb-servers in separate
>> containers?
>> Where would northd run?
>
>
>
> The Openstack kolla project [1], it generates a separate container image for
> vswitchd and ovsdb-server.
> The goal is to support kolla images for OVN. I have submitted the patch here
> [2].
> Based on the present approach taken in kolla for openvswitch, this patch
> generates a separate container image for nb ovsdb-server, sb ovsdb-server,
> ovn-northd and ovn-controller. the nb ovsdb-server, sb ovsdb-server and
> ovn-northd is expected to be run in the same host (as separate containers).
>
> [1] - https://github.com/openstack/kolla/tree/master/docker/openvswitch
> [2] - https://review.openstack.org/#/c/459179/
>
Thanks, this is useful background information. I will push the patch
to master soon.
Miguel Angel Ajo May 29, 2017, 11:36 a.m. UTC | #4
Acked-By: Miguel Angel Ajo <majopela@redhat.com>

On Fri, May 26, 2017 at 7:36 PM, Andy Zhou <azhou@ovn.org> wrote:

> On Fri, May 26, 2017 at 4:48 AM, Numan Siddique <nusiddiq@redhat.com>
> wrote:
> >
> >
> > On Fri, May 26, 2017 at 3:30 AM, Andy Zhou <azhou@ovn.org> wrote:
> >>
> >> On Thu, May 25, 2017 at 1:55 AM,  <nusiddiq@redhat.com> wrote:
> >> > From: Numan Siddique <nusiddiq@redhat.com>
> >> >
> >> > 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 <nusiddiq@redhat.com>
> >>
> >> LGTM.
> >> Acked-by: Andy Zhou <azhou@ovn.org>
> >>
> >> What's the intended use cases for running ovsdb-servers in separate
> >> containers?
> >> Where would northd run?
> >
> >
> >
> > The Openstack kolla project [1], it generates a separate container image
> for
> > vswitchd and ovsdb-server.
> > The goal is to support kolla images for OVN. I have submitted the patch
> here
> > [2].
> > Based on the present approach taken in kolla for openvswitch, this patch
> > generates a separate container image for nb ovsdb-server, sb
> ovsdb-server,
> > ovn-northd and ovn-controller. the nb ovsdb-server, sb ovsdb-server and
> > ovn-northd is expected to be run in the same host (as separate
> containers).
> >
> > [1] - https://github.com/openstack/kolla/tree/master/docker/openvswitch
> > [2] - https://review.openstack.org/#/c/459179/
> >
> Thanks, this is useful background information. I will push the patch
> to master soon.
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox

Patch

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
         ;;