diff mbox

[ovs-dev,2/4] ovs-sandbox: add '-u, --disable-dummy' options.

Message ID 1481014882-99783-2-git-send-email-nic@opencloud.tech
State Changes Requested
Headers show

Commit Message

nickcooper-zhangtonghao Dec. 6, 2016, 9:01 a.m. UTC
The ovs-sandbox runs in the "dummy mode" by default.
In this mode of testing, no packets travel across
physical or virtual networks. But sometimes, we may
create veth network devices and add them to ovs bridge
for developing and testing. It's necessary to add an option.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
---
 tutorial/ovs-sandbox | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Ben Pfaff Dec. 6, 2016, 7:26 p.m. UTC | #1
On Tue, Dec 06, 2016 at 01:01:20AM -0800, nickcooper-zhangtonghao wrote:
> The ovs-sandbox runs in the "dummy mode" by default.
> In this mode of testing, no packets travel across
> physical or virtual networks. But sometimes, we may
> create veth network devices and add them to ovs bridge
> for developing and testing. It's necessary to add an option.
> 
> Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>

This seems like a clumsy way to implement this.  Why not set a variable
to the options above option parsing, then clear that variable if the
option is specified?

-u isn't a very memorable option for this.  I'd recommend leaving off a
short option entirely.
diff mbox

Patch

diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox
index 4372da4..62f0844 100755
--- a/tutorial/ovs-sandbox
+++ b/tutorial/ovs-sandbox
@@ -61,6 +61,7 @@  gdb_ovn_controller=false
 gdb_ovn_controller_ex=false
 gdb_ovn_controller_vtep=false
 gdb_ovn_controller_vtep_ex=false
+disable_dummy_vswitchd=false
 builddir=
 srcdir=
 schema=
@@ -108,6 +109,7 @@  These options force ovs-sandbox to use a particular OVS build:
 These options force ovs-sandbox to use an installed Open vSwitch:
   -i, --installed      use installed Open vSwitch
   -g, --gdb-vswitchd   run ovs-vswitchd under gdb
+  -u, --disable-dummy  run ovs-vswitchd with disable-dummy mode
   -d, --gdb-ovsdb      run ovsdb-server under gdb
   --gdb-ovn-northd     run ovn-northd under gdb
   --gdb-ovn-controller run ovn-controller under gdb
@@ -154,6 +156,9 @@  EOF
             gdb_vswitchd=true
             gdb_vswitchd_ex=false
             ;;
+        -u|--disable-dummy)
+            disable_dummy_vswitchd=true
+            ;;
         -e|--gdb-ex-v*)
             gdb_vswitchd=true
             gdb_vswitchd_ex=true
@@ -360,8 +365,13 @@  fi
 run ovs-vsctl --no-wait -- init
 
 # Start ovs-vswitchd.
+ovs_vswitchd_dummy_arg="--enable-dummy=override -vnetdev_dummy"
+if $disable_dummy_vswitchd; then
+    ovs_vswitchd_dummy_arg=
+fi
+
 rungdb $gdb_vswitchd $gdb_vswitchd_ex ovs-vswitchd --detach --no-chdir --pidfile -vconsole:off --log-file \
-    --enable-dummy=override -vvconn -vnetdev_dummy
+    -vvconn $ovs_vswitchd_dummy_arg
 
 if $ovn; then
     ovs-vsctl set open . external-ids:system-id=56b18105-5706-46ef-80c4-ff20979ab068