diff mbox series

[ovs-dev,RFC] tests: Add a default timeout for control utilities

Message ID 20170828171459.16228-1-aserdean@ovn.org
State Accepted
Headers show
Series [ovs-dev,RFC] tests: Add a default timeout for control utilities | expand

Commit Message

Alin-Gabriel Serdean Aug. 28, 2017, 5:14 p.m. UTC
Let's suppose that ovsdb-server is running properly, but ovs-vswitchd
is not responsive/crashed. We try to add a port via ovs-vsctl and it will
hang.
This patch aims at that scenario and tries to make life easier when
debugging hanging tests.

Some shells do not allow dashes in function names (default behavior),
we shall try to define an alias to overcome dashes if the shell allows it.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Suggested-by: Ben Pfaff <blp@ovn.org>
---
 tests/ovs-macros.at | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Ben Pfaff Sept. 2, 2017, 3:52 p.m. UTC | #1
On Mon, Aug 28, 2017 at 08:14:59PM +0300, Alin Gabriel Serdean wrote:
> Let's suppose that ovsdb-server is running properly, but ovs-vswitchd
> is not responsive/crashed. We try to add a port via ovs-vsctl and it will
> hang.
> This patch aims at that scenario and tries to make life easier when
> debugging hanging tests.
> 
> Some shells do not allow dashes in function names (default behavior),
> we shall try to define an alias to overcome dashes if the shell allows it.
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> Suggested-by: Ben Pfaff <blp@ovn.org>

Acked-by: Ben Pfaff <blp@ovn.org>
Ben Pfaff Oct. 31, 2017, 10:32 p.m. UTC | #2
On Sat, Sep 02, 2017 at 08:52:38AM -0700, Ben Pfaff wrote:
> On Mon, Aug 28, 2017 at 08:14:59PM +0300, Alin Gabriel Serdean wrote:
> > Let's suppose that ovsdb-server is running properly, but ovs-vswitchd
> > is not responsive/crashed. We try to add a port via ovs-vsctl and it will
> > hang.
> > This patch aims at that scenario and tries to make life easier when
> > debugging hanging tests.
> > 
> > Some shells do not allow dashes in function names (default behavior),
> > we shall try to define an alias to overcome dashes if the shell allows it.
> > 
> > Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> > Suggested-by: Ben Pfaff <blp@ovn.org>
> 
> Acked-by: Ben Pfaff <blp@ovn.org>

I expected that you'd apply this, but, anyway, I've done it just now.
Alin Serdean Nov. 1, 2017, 9:53 p.m. UTC | #3
> -----Original Message-----
> From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-
> bounces@openvswitch.org] On Behalf Of Ben Pfaff
> Sent: Wednesday, November 1, 2017 12:32 AM
> To: Alin Gabriel Serdean <aserdean@ovn.org>
> Cc: dev@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH, RFC] tests: Add a default timeout for control
> utilities
> 
> On Sat, Sep 02, 2017 at 08:52:38AM -0700, Ben Pfaff wrote:
> > On Mon, Aug 28, 2017 at 08:14:59PM +0300, Alin Gabriel Serdean wrote:
> > > Let's suppose that ovsdb-server is running properly, but
> > > ovs-vswitchd is not responsive/crashed. We try to add a port via
> > > ovs-vsctl and it will hang.
> > > This patch aims at that scenario and tries to make life easier when
> > > debugging hanging tests.
> > >
> > > Some shells do not allow dashes in function names (default
> > > behavior), we shall try to define an alias to overcome dashes if the shell
> allows it.
> > >
> > > Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> > > Suggested-by: Ben Pfaff <blp@ovn.org>
> >
> > Acked-by: Ben Pfaff <blp@ovn.org>
> 
> I expected that you'd apply this, but, anyway, I've done it just now.
[Alin Serdean] Thanks Ben! I was convinced I applied this patch before I went on vacation but apparently, I didn't. Sorry!
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Ben Pfaff Nov. 2, 2017, 6:31 p.m. UTC | #4
On Wed, Nov 01, 2017 at 09:53:48PM +0000, Alin Serdean wrote:
> > -----Original Message-----
> > From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-
> > bounces@openvswitch.org] On Behalf Of Ben Pfaff
> > Sent: Wednesday, November 1, 2017 12:32 AM
> > To: Alin Gabriel Serdean <aserdean@ovn.org>
> > Cc: dev@openvswitch.org
> > Subject: Re: [ovs-dev] [PATCH, RFC] tests: Add a default timeout for control
> > utilities
> > 
> > On Sat, Sep 02, 2017 at 08:52:38AM -0700, Ben Pfaff wrote:
> > > On Mon, Aug 28, 2017 at 08:14:59PM +0300, Alin Gabriel Serdean wrote:
> > > > Let's suppose that ovsdb-server is running properly, but
> > > > ovs-vswitchd is not responsive/crashed. We try to add a port via
> > > > ovs-vsctl and it will hang.
> > > > This patch aims at that scenario and tries to make life easier when
> > > > debugging hanging tests.
> > > >
> > > > Some shells do not allow dashes in function names (default
> > > > behavior), we shall try to define an alias to overcome dashes if the shell
> > allows it.
> > > >
> > > > Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> > > > Suggested-by: Ben Pfaff <blp@ovn.org>
> > >
> > > Acked-by: Ben Pfaff <blp@ovn.org>
> > 
> > I expected that you'd apply this, but, anyway, I've done it just now.
> [Alin Serdean] Thanks Ben! I was convinced I applied this patch before I went on vacation but apparently, I didn't. Sorry!

No problem, I hope you enjoyed your vacation.
diff mbox series

Patch

diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index dbce0a5..afe4032 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -100,6 +100,43 @@  if test "$IS_WIN32" = "yes"; then
     }
 fi
 
+# Try to add a default timeout for the following control utilities:
+#     - ovs-vsctl
+#     - ovs-ofctl
+#     - ovs-appctl
+#     - ovn-sbctl
+#     - ovn-nbctl
+#     - vtep-ctl
+# Set default timeout for 30 seconds.
+# This should be sufficient on all platforms.
+OVS_TIMEOUT=30
+alias ovs-vsctl='OVS_VSCTL_TIMEOUT' >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+    OVS_VSCTL_TIMEOUT () {
+        command ovs-vsctl --timeout=$OVS_TIMEOUT "$@"
+    }
+    alias ovs-ofctl='OVS_OFCTL_TIMEOUT'
+    alias ovs-appctl='OVS_APPCTL_TIMEOUT'
+    alias ovn-sbctl='OVS_SBCTL_TIMEOUT'
+    alias ovn-nbctl='OVN_NBCTL_TIMEOUT'
+    alias vtep-ctl='VTEP_CTL_TIMEOUT'
+    OVS_OFCTL_TIMEOUT () {
+        command ovs-ofctl --timeout=$OVS_TIMEOUT "$@"
+    }
+    OVS_APPCTL_TIMEOUT () {
+        command ovs-appctl --timeout=$OVS_TIMEOUT "$@"
+    }
+    OVS_SBCTL_TIMEOUT () {
+        command ovn-sbctl --timeout=$OVS_TIMEOUT "$@"
+    }
+    OVN_NBCTL_TIMEOUT () {
+        command ovn-nbctl --timeout=$OVS_TIMEOUT "$@"
+    }
+    VTEP_CTL_TIMEOUT () {
+        command vtep-ctl --timeout=$OVS_TIMEOUT "$@"
+    }
+fi
+
 # parent_pid PID
 #
 # Prints the PID of the parent of process PID.