Re: [ovs-dev] [PATCH] ovn-ctl: Provide the option to detach the OVN db servers or not when starting

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 11:41:17PM +0530, Numan Siddique wrote:
> On Thu, Nov 2, 2017 at 11:15 PM, Ben Pfaff  wrote:
> 
> > On Thu, Nov 02, 2017 at 04:55:14PM +0530, nusid...@redhat.com wrote:
> > > From: Numan Siddique 
> > >
> > > Presently if the user wants to start OVN db servers as separate
> > containers, 'ovn-ctl'
> > > script is not useful as '--detach' option is passed when ovsdb-servers
> > are started.
> > > If the container command is 'ovn-ctl start_nb_ovsdb', the  container
> > exits as soon as
> > > ovn-ctl exits.
> > >
> > > This patch adds 2 new options to the 'ovn-ctl' script - '--db-nb-detach'
> > and
> > > '--db-sb-detach' which can take 'yes/no'. This will be really useful for
> > the above
> > > mentioned requirement. The user can start NB ovsdb-server with the
> > command
> > > 'ovn-ctl start_nb_ovsdb --db-nb-detach=no'.
> > >
> > > Without this option, the user may have to first generate the db by
> > running 'ovsdb-tool'
> > > and then start the container with the command 'ovsdb-server ovnnb_db.db
> > ' and this
> > > is very inconvenient. This option will be useful only if the OVN db
> > servers are started
> > > in separate containers.
> > >
> > > This patch also updates the missing documentation in ovn-ctl.8.xml.
> > >
> > > Signed-off-by: Numan Siddique 
> >
> > Despite the small patch, this is a major change in actual functionality,
> > since, with this option, ovn-ctl changes from a fast-running script that
> > just starts or stops a daemon, to a long-running script that waits for
> > the daemon to exit.
> >
> > I wonder whether this would warrant new commands, e.g. run_nb_ovsdb and
> > run_sb_ovsdb.  These could be implemented internally by just adding the
> > option, I guess.
> >
> > Another way might be to add a command to wait for a service to exit.
> >
> > The "ovn-[sn]bctl init" commands won't run, in this case.  Maybe that is
> > not too important.
> >
> > --detach and --monitor are independent.  Is there a reason to remove
> > --monitor when removing --detach?
> >
> 
> Thanks Ben. I agree. I will work based on your suggestions.
> In the case of containers, I thnk monitor is not required. The life of the
> container in the case of ovsdb-server would be till it runs.
> In case the ovsdb-server exits unexpectedly, the container
> management service (like docker) can restart the container if "restart"
> flag is set when starting the container.
> Please let me know if this doesn't sound fine.

I think that's OK, then.

It would be good to explain what this does, and why, and when might want
to use it, in the ovn-ctl manpage.

Thanks,

Ben.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ovn-ctl: Provide the option to detach the OVN db servers or not when starting

2017-11-02 Thread Numan Siddique
On Thu, Nov 2, 2017 at 11:15 PM, Ben Pfaff  wrote:

> On Thu, Nov 02, 2017 at 04:55:14PM +0530, nusid...@redhat.com wrote:
> > From: Numan Siddique 
> >
> > Presently if the user wants to start OVN db servers as separate
> containers, 'ovn-ctl'
> > script is not useful as '--detach' option is passed when ovsdb-servers
> are started.
> > If the container command is 'ovn-ctl start_nb_ovsdb', the  container
> exits as soon as
> > ovn-ctl exits.
> >
> > This patch adds 2 new options to the 'ovn-ctl' script - '--db-nb-detach'
> and
> > '--db-sb-detach' which can take 'yes/no'. This will be really useful for
> the above
> > mentioned requirement. The user can start NB ovsdb-server with the
> command
> > 'ovn-ctl start_nb_ovsdb --db-nb-detach=no'.
> >
> > Without this option, the user may have to first generate the db by
> running 'ovsdb-tool'
> > and then start the container with the command 'ovsdb-server ovnnb_db.db
> ' and this
> > is very inconvenient. This option will be useful only if the OVN db
> servers are started
> > in separate containers.
> >
> > This patch also updates the missing documentation in ovn-ctl.8.xml.
> >
> > Signed-off-by: Numan Siddique 
>
> Despite the small patch, this is a major change in actual functionality,
> since, with this option, ovn-ctl changes from a fast-running script that
> just starts or stops a daemon, to a long-running script that waits for
> the daemon to exit.
>
> I wonder whether this would warrant new commands, e.g. run_nb_ovsdb and
> run_sb_ovsdb.  These could be implemented internally by just adding the
> option, I guess.
>
> Another way might be to add a command to wait for a service to exit.
>
> The "ovn-[sn]bctl init" commands won't run, in this case.  Maybe that is
> not too important.
>
> --detach and --monitor are independent.  Is there a reason to remove
> --monitor when removing --detach?
>

Thanks Ben. I agree. I will work based on your suggestions.
In the case of containers, I thnk monitor is not required. The life of the
container in the case of ovsdb-server would be till it runs.
In case the ovsdb-server exits unexpectedly, the container
management service (like docker) can restart the container if "restart"
flag is set when starting the container.
Please let me know if this doesn't sound fine.

Thanks
Numan
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ovn-ctl: Provide the option to detach the OVN db servers or not when starting

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 04:55:14PM +0530, nusid...@redhat.com wrote:
> From: Numan Siddique 
> 
> Presently if the user wants to start OVN db servers as separate containers, 
> 'ovn-ctl'
> script is not useful as '--detach' option is passed when ovsdb-servers are 
> started.
> If the container command is 'ovn-ctl start_nb_ovsdb', the  container exits as 
> soon as
> ovn-ctl exits.
> 
> This patch adds 2 new options to the 'ovn-ctl' script - '--db-nb-detach' and
> '--db-sb-detach' which can take 'yes/no'. This will be really useful for the 
> above
> mentioned requirement. The user can start NB ovsdb-server with the command
> 'ovn-ctl start_nb_ovsdb --db-nb-detach=no'.
> 
> Without this option, the user may have to first generate the db by running 
> 'ovsdb-tool'
> and then start the container with the command 'ovsdb-server ovnnb_db.db ' 
> and this
> is very inconvenient. This option will be useful only if the OVN db servers 
> are started
> in separate containers.
> 
> This patch also updates the missing documentation in ovn-ctl.8.xml.
> 
> Signed-off-by: Numan Siddique 

Despite the small patch, this is a major change in actual functionality,
since, with this option, ovn-ctl changes from a fast-running script that
just starts or stops a daemon, to a long-running script that waits for
the daemon to exit.

I wonder whether this would warrant new commands, e.g. run_nb_ovsdb and
run_sb_ovsdb.  These could be implemented internally by just adding the
option, I guess.

Another way might be to add a command to wait for a service to exit.

The "ovn-[sn]bctl init" commands won't run, in this case.  Maybe that is
not too important.

--detach and --monitor are independent.  Is there a reason to remove
--monitor when removing --detach?
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] ovn-ctl: Provide the option to detach the OVN db servers or not when starting

2017-11-02 Thread nusiddiq
From: Numan Siddique 

Presently if the user wants to start OVN db servers as separate containers, 
'ovn-ctl'
script is not useful as '--detach' option is passed when ovsdb-servers are 
started.
If the container command is 'ovn-ctl start_nb_ovsdb', the  container exits as 
soon as
ovn-ctl exits.

This patch adds 2 new options to the 'ovn-ctl' script - '--db-nb-detach' and
'--db-sb-detach' which can take 'yes/no'. This will be really useful for the 
above
mentioned requirement. The user can start NB ovsdb-server with the command
'ovn-ctl start_nb_ovsdb --db-nb-detach=no'.

Without this option, the user may have to first generate the db by running 
'ovsdb-tool'
and then start the container with the command 'ovsdb-server ovnnb_db.db ' 
and this
is very inconvenient. This option will be useful only if the OVN db servers are 
started
in separate containers.

This patch also updates the missing documentation in ovn-ctl.8.xml.

Signed-off-by: Numan Siddique 
---
 ovn/utilities/ovn-ctl   | 15 +--
 ovn/utilities/ovn-ctl.8.xml |  9 +
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index 3e247a1c6..8261b82c7 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -100,7 +100,10 @@ start_nb_ovsdb() {
 
 set ovsdb-server
 
-set "$@" --detach --monitor
+if test X"$DB_NB_DETACH" = Xyes; then
+set "$@" --detach --monitor
+fi
+
 set "$@" $OVN_NB_LOG --log-file=$OVN_NB_LOGFILE
 set "$@" --remote=punix:$DB_NB_SOCK --pidfile=$DB_NB_PID
 set "$@" --remote=db:OVN_Northbound,NB_Global,connections
@@ -135,7 +138,10 @@ start_sb_ovsdb() {
 
 set ovsdb-server
 
-set "$@" --detach --monitor
+if test X"$DB_SB_DETACH" = Xyes; then
+set "$@" --detach --monitor
+fi
+
 set "$@" $OVN_SB_LOG --log-file=$OVN_SB_LOGFILE
 set "$@" --remote=punix:$DB_SB_SOCK --pidfile=$DB_SB_PID
 set "$@" --remote=db:OVN_Southbound,SB_Global,connections
@@ -383,6 +389,9 @@ set_defaults () {
 DB_NB_CREATE_INSECURE_REMOTE="no"
 
 MONITOR="yes"
+
+DB_NB_DETACH="yes"
+DB_SB_DETACH="yes"
 }
 
 set_option () {
@@ -469,6 +478,8 @@ File location options:
   --db-sb-sync-from-port=ADDR OVN Southbound active db tcp port (default: 
$DB_SB_SYNC_FROM_PORT)
   --db-sb-sync-from-proto=PROTO OVN Southbound active db transport (default: 
$DB_SB_SYNC_FROM_PROTO)
   --db-sb-create-insecure-remote=yes|no Create ptcp OVN Southbound remote 
(default: $DB_SB_CREATE_INSECURE_REMOTE)
+  --db-nb-detach=yes|no OVN_Northbound detach server (default: $DB_NB_DETACH)
+  --db-sb-detach=yes|no OVN_Southbound detach server (default: $DB_SB_DETACH)
 
 Default directories with "configure" option and environment variable override:
   logs: /usr/local/var/log/openvswitch (--with-logdir, OVS_LOGDIR)
diff --git a/ovn/utilities/ovn-ctl.8.xml b/ovn/utilities/ovn-ctl.8.xml
index 7b090aee4..457475c19 100644
--- a/ovn/utilities/ovn-ctl.8.xml
+++ b/ovn/utilities/ovn-ctl.8.xml
@@ -28,6 +28,13 @@
   demote_ovnsb
   status_ovnnb
   status_ovnsb
+  start_ovsdb
+  start_nb_ovsdb
+  start_sb_ovsdb
+  stop_ovsdb
+  stop_nb_ovsdb
+  stop_sb_ovsdb
+  restart_ovsdb
 
 
 Options
@@ -35,6 +42,8 @@
 --ovn-northd-wrapper=WRAPPER
 --ovn-controller-priority=NICE
 --ovn-controller-wrapper=WRAPPER
+--db-nb-detach=yes|no
+--db-sb-detach=yes|no
 -h | --help
 
 File location options
-- 
2.13.5

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev