X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fovs-ctl.in;h=674c3c31e5c7e302a35b9876d2afdd32972dcaed;hb=26720e2449918b92be1fd0e3a7c57012c057c733;hp=cb41cc06d3780e9d279ceaf403404ff1c3bfe841;hpb=c707d418149a343be49b472322be0bd5c0afb036;p=openvswitch diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index cb41cc06..674c3c31 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -172,12 +172,14 @@ set_system_ids () { action "Configuring Open vSwitch system IDs" "$@" $extra_ids } -start () { +check_force_cores () { if test X"$FORCE_COREFILES" = Xyes; then ulimit -Sc 67108864 fi +} - insert_mod_if_required || return 1 +start_ovsdb () { + check_force_cores if daemon_is_running ovsdb-server; then log_success_msg "ovsdb-server is already running" @@ -206,6 +208,12 @@ start () { done fi fi +} + +start_forwarding () { + check_force_cores + + insert_mod_if_required || return 1 if daemon_is_running ovs-vswitchd; then log_success_msg "ovs-vswitchd is already running" @@ -237,10 +245,13 @@ start () { ## stop ## ## ---- ## -stop () { +stop_ovsdb () { + stop_daemon ovsdb-server +} + +stop_forwarding () { stop_daemon ovs-brcompatd stop_daemon ovs-vswitchd - stop_daemon ovsdb-server } ## ----------------- ## @@ -276,7 +287,12 @@ force_reload_kmod () { ifaces=`internal_interfaces` action "Detected internal interfaces: $ifaces" true - stop + # Restart the database first, since a large database may take a + # while to load, and we want to minimize forwarding disruption. + stop_ovsdb + start_ovsdb + + stop_forwarding script=`mktemp` trap 'rm -f "$script"' 0 1 2 13 15 @@ -284,7 +300,7 @@ force_reload_kmod () { : else log_warning_msg "Failed to save configuration, not replacing kernel module" - start + start_forwarding exit 1 fi chmod +x "$script" @@ -305,7 +321,7 @@ force_reload_kmod () { action "Removing openvswitch module" rmmod openvswitch fi - start + start_forwarding action "Restoring interface configuration" "$script" rc=$? @@ -387,7 +403,7 @@ set_defaults () { OVS_VSWITCHD_WRAPPER= OVS_BRCOMPATD_WRAPPER= - DB_FILE=$etcdir/conf.db + DB_FILE=$dbdir/conf.db DB_SOCK=$rundir/db.sock DB_SCHEMA=$datadir/vswitch.ovsschema @@ -475,8 +491,9 @@ Other options: -V, --version display version information Default directories with "configure" option and environment variable override: - logs: @LOGDIR@ (--log-dir, OVS_LOGDIR) - pidfiles and sockets: @RUNDIR@ (--run-dir, OVS_RUNDIR) + logs: @LOGDIR@ (--with-logdir, OVS_LOGDIR) + pidfiles and sockets: @RUNDIR@ (--with-rundir, OVS_RUNDIR) + conf.db: @DBDIR@ (--with-dbdir, OVS_DBDIR) system configuration: @sysconfdir@ (--sysconfdir, OVS_SYSCONFDIR) data files: @pkgdatadir@ (--pkgdatadir, OVS_PKGDATADIR) user binaries: @bindir@ (--bindir, OVS_BINDIR) @@ -567,10 +584,12 @@ do done case $command in start) - start + start_ovsdb + start_forwarding ;; stop) - stop + stop_forwarding + stop_ovsdb ;; status) rc=0