diff mbox

[ovs-dev] vtep-ctl: Exit if database connection fails.

Message ID 1445549835-12057-1-git-send-email-diproiettod@vmware.com
State Accepted
Headers show

Commit Message

Daniele Di Proietto Oct. 22, 2015, 9:37 p.m. UTC
Before this commit vtep-ctl hung forever if it didn't manage to reach
the database.

This caused the testcase "ovn -- 3 HVs, 1 VIFs/HV, 1 GW, 1 LS" to hang
occasionally, because ovsdb-server could be killed before ovs-vtep
called vtep-ctl.

This mimics the behaviour of ovs-vsctl, ovn-nbctl and ovn-sbctl.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
CC: Ansis Atteka <aatteka@nicira.com>
CC: Gurucharan Shetty <shettyg@nicira.com>
---
 vtep/vtep-ctl.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Justin Pettit Oct. 22, 2015, 11:11 p.m. UTC | #1
> 
> On Oct 22, 2015, at 2:37 PM, Daniele Di Proietto <diproiettod@vmware.com> wrote:
> 
> Before this commit vtep-ctl hung forever if it didn't manage to reach
> the database.
> 
> This caused the testcase "ovn -- 3 HVs, 1 VIFs/HV, 1 GW, 1 LS" to hang
> occasionally, because ovsdb-server could be killed before ovs-vtep
> called vtep-ctl.
> 
> This mimics the behaviour of ovs-vsctl, ovn-nbctl and ovn-sbctl.
> 
> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>

Thanks!

Acked-by: Justin Pettit <jpettit@nicira.com>

--Justin
Daniele Di Proietto Oct. 23, 2015, 12:31 a.m. UTC | #2
On 22/10/2015 16:11, "Justin Pettit" <jpettit@nicira.com> wrote:

>> 
>> On Oct 22, 2015, at 2:37 PM, Daniele Di Proietto
>><diproiettod@vmware.com> wrote:
>> 
>> Before this commit vtep-ctl hung forever if it didn't manage to reach
>> the database.
>> 
>> This caused the testcase "ovn -- 3 HVs, 1 VIFs/HV, 1 GW, 1 LS" to hang
>> occasionally, because ovsdb-server could be killed before ovs-vtep
>> called vtep-ctl.
>> 
>> This mimics the behaviour of ovs-vsctl, ovn-nbctl and ovn-sbctl.
>> 
>> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
>
>Thanks!
>
>Acked-by: Justin Pettit <jpettit@nicira.com>
>
>--Justin

Thanks for the review! I applied this to master with your ack.
diff mbox

Patch

diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
index c3789d2..604d19d 100644
--- a/vtep/vtep-ctl.c
+++ b/vtep/vtep-ctl.c
@@ -135,6 +135,11 @@  main(int argc, char *argv[])
     seqno = ovsdb_idl_get_seqno(idl);
     for (;;) {
         ovsdb_idl_run(idl);
+        if (!ovsdb_idl_is_alive(idl)) {
+            int retval = ovsdb_idl_get_last_error(idl);
+            ctl_fatal("%s: database connection failed (%s)",
+                        db, ovs_retval_to_string(retval));
+        }
 
         if (seqno != ovsdb_idl_get_seqno(idl)) {
             seqno = ovsdb_idl_get_seqno(idl);