Re: [ovs-dev] [PATCH v2] ovn: Initialize the databases.

2016-09-23 Thread Guru Shetty
On 22 September 2016 at 09:54, Ben Pfaff  wrote:

> On Mon, Sep 19, 2016 at 03:52:55AM -0700, Gurucharan Shetty wrote:
> > Without initializing the databases, commands of the form
> > 'ovn-nbctl --wait=sb ls-add ls0' will simply hang.
> >
> > Signed-off-by: Gurucharan Shetty 
>
> Thanks!
>
> Acked-by: Ben Pfaff 
>

Thanks, I applied this to master and 2.6
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v2] ovn: Initialize the databases.

2016-09-22 Thread Ben Pfaff
On Mon, Sep 19, 2016 at 03:52:55AM -0700, Gurucharan Shetty wrote:
> Without initializing the databases, commands of the form
> 'ovn-nbctl --wait=sb ls-add ls0' will simply hang.
> 
> Signed-off-by: Gurucharan Shetty 

Thanks!

Acked-by: Ben Pfaff 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH v2] ovn: Initialize the databases.

2016-09-19 Thread Gurucharan Shetty
Without initializing the databases, commands of the form
'ovn-nbctl --wait=sb ls-add ls0' will simply hang.

Signed-off-by: Gurucharan Shetty 
---
 ovn/northd/ovn-northd.c | 10 +++---
 ovn/utilities/ovn-ctl   |  2 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index a91e1f8..a30b4b4 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -4263,11 +4263,15 @@ ovnnb_db_run(struct northd_context *ctx, struct 
ovsdb_idl_loop *sb_loop)
  *
  * Also set up to update sb_cfg once our southbound transaction commits. */
 const struct nbrec_nb_global *nb = nbrec_nb_global_first(ctx->ovnnb_idl);
+if (!nb) {
+nb = nbrec_nb_global_insert(ctx->ovnnb_txn);
+}
 const struct sbrec_sb_global *sb = sbrec_sb_global_first(ctx->ovnsb_idl);
-if (nb && sb) {
-sbrec_sb_global_set_nb_cfg(sb, nb->nb_cfg);
-sb_loop->next_cfg = nb->nb_cfg;
+if (!sb) {
+sb = sbrec_sb_global_insert(ctx->ovnsb_txn);
 }
+sbrec_sb_global_set_nb_cfg(sb, nb->nb_cfg);
+sb_loop->next_cfg = nb->nb_cfg;
 
 cleanup_macam();
 }
diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index 07bff8a..8544d14 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -55,6 +55,7 @@ start_ovsdb () {
 set "$@" --detach --monitor $OVN_NB_LOG --log-file=$OVN_NB_LOGFILE 
--remote=punix:$DB_NB_SOCK --remote=ptcp:$DB_NB_PORT:$DB_NB_ADDR 
--pidfile=$DB_NB_PID --unixctl=ovnnb_db.ctl
 
 $@ $DB_NB_FILE
+ovn-nbctl init
 fi
 
 # Check and eventually start ovsdb-server for Southbound DB
@@ -65,6 +66,7 @@ start_ovsdb () {
 
 set "$@" --detach --monitor $OVN_SB_LOG --log-file=$OVN_SB_LOGFILE 
--remote=punix:$DB_SB_SOCK --remote=ptcp:$DB_SB_PORT:$DB_SB_ADDR 
--pidfile=$DB_SB_PID --unixctl=ovnsb_db.ctl
 $@ $DB_SB_FILE
+ovn-sbctl init
 fi
 }
 
-- 
1.9.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev