mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 09:58:01 +00:00
ovs-ctl: Allow selective start for db and switch
Currently, ``ovs-ctl start'' will attempt to start both the DB and vswitchd. This is quite convenient when the database already has all of the configuration values required, and when using a single services file for systemd integration. The same goes for the ``ovs-ctl stop'' command. However, there are some cases which are not easily covered. The case where we want to set values in the database prior to starting the forwarding path, as well as the case of supporting multiple service files, one per daemon (which is how systemd expects services to look). Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
parent
2eb5deea6d
commit
7fc28c50c0
3
NEWS
3
NEWS
@ -30,6 +30,9 @@ Post-v2.5.0
|
|||||||
bitrot.
|
bitrot.
|
||||||
- ovs-appctl:
|
- ovs-appctl:
|
||||||
* New "vlog/close" command.
|
* New "vlog/close" command.
|
||||||
|
- ovs-ctl:
|
||||||
|
* Added the ability to selectively start the forwarding and database
|
||||||
|
functions (ovs-vswitchd and ovsdb-server, respectively).
|
||||||
- ovsdb-server:
|
- ovsdb-server:
|
||||||
* Remove max number of sessions limit, to enable connection scaling
|
* Remove max number of sessions limit, to enable connection scaling
|
||||||
testing.
|
testing.
|
||||||
|
@ -81,7 +81,8 @@ If the database does exist, but it has an obsolete version, it
|
|||||||
upgrades it to the latest schema.
|
upgrades it to the latest schema.
|
||||||
.
|
.
|
||||||
.IP 3.
|
.IP 3.
|
||||||
Starts \fBovsdb-server\fR.
|
Starts \fBovsdb-server\fR, unless the \fB\-\-no\-ovsdb\-server\fR command
|
||||||
|
option is given.
|
||||||
.
|
.
|
||||||
.IP 4.
|
.IP 4.
|
||||||
Initializes a few values inside the database.
|
Initializes a few values inside the database.
|
||||||
@ -96,7 +97,8 @@ that have \fBother_config:transient\fR set to true.
|
|||||||
.
|
.
|
||||||
.PP
|
.PP
|
||||||
The \fBstart\fR command skips the following step if
|
The \fBstart\fR command skips the following step if
|
||||||
\fBovs\-vswitchd\fR is already running:
|
\fBovs\-vswitchd\fR is already running, or if the \fB\-\-no\-ovs\-vswitchd\fR
|
||||||
|
command option is given:
|
||||||
.IP 7.
|
.IP 7.
|
||||||
Starts \fBovs\-vswitchd\fR.
|
Starts \fBovs\-vswitchd\fR.
|
||||||
.
|
.
|
||||||
@ -238,7 +240,9 @@ taken as relative to \fIdbdir\fR.
|
|||||||
.
|
.
|
||||||
.PP
|
.PP
|
||||||
The \fBstop\fR command does not unload the Open vSwitch kernel
|
The \fBstop\fR command does not unload the Open vSwitch kernel
|
||||||
modules.
|
modules. It can take the same \fB\-\-no\-ovsdb\-server\fR and
|
||||||
|
\fB\-\-no\-ovs\-vswitchd\fR options as that of the \fBstart\fR
|
||||||
|
command.
|
||||||
.
|
.
|
||||||
.PP
|
.PP
|
||||||
This command does nothing and finishes successfully if the OVS daemons
|
This command does nothing and finishes successfully if the OVS daemons
|
||||||
@ -314,7 +318,8 @@ particular distribution and installation.)
|
|||||||
.
|
.
|
||||||
.PP
|
.PP
|
||||||
\fBforce\-kmod\-reload\fR internally stops and starts OVS, so it
|
\fBforce\-kmod\-reload\fR internally stops and starts OVS, so it
|
||||||
accepts all of the options accepted by the \fBstart\fR command.
|
accepts all of the options accepted by the \fBstart\fR command except
|
||||||
|
for the \fB\-\-no\-ovs\-vswitchd\fR option.
|
||||||
.
|
.
|
||||||
.SH "The ``load\-kmod'' command"
|
.SH "The ``load\-kmod'' command"
|
||||||
.
|
.
|
||||||
@ -377,8 +382,23 @@ Prints a usage message and exits successfully.
|
|||||||
.
|
.
|
||||||
.SH "OPTIONS"
|
.SH "OPTIONS"
|
||||||
.PP
|
.PP
|
||||||
In addition to the options listed for each command above, this option
|
In addition to the options listed for each command above, these options
|
||||||
controls the behavior of several of \fBovs\-ctl\fR's commands.
|
control the behavior of several of \fBovs\-ctl\fR's commands.
|
||||||
|
.
|
||||||
|
.PP
|
||||||
|
By default, \fBovs\-ctl\fR will control the \fBovsdb\-server\fR, and
|
||||||
|
the \fBovs\-vswitchd\fR daemons. The following options restrict that control
|
||||||
|
to exclude one or the other:
|
||||||
|
.
|
||||||
|
.IP "\fB\-\-no\-ovsdb-server\fR"
|
||||||
|
Specifies that the \fBovs\-ctl\fR commands \fBstart\fR, \fBstop\fR, and
|
||||||
|
\fBrestart\fR should not modify the running status of \fBovsdb\-server\fR.
|
||||||
|
.
|
||||||
|
.IP "\fB\-\-no\-ovs\-vswitchd\fR"
|
||||||
|
Specifies that the \fBovs\-ctl\fR commands \fBstart\fR, \fBstop\fR, and
|
||||||
|
\fBrestart\fR should not modify the running status of \fBovs\-vswitchd\fR.
|
||||||
|
It is an error to include this option with the \fBforce\-reload\-kmod\fR
|
||||||
|
command.
|
||||||
.
|
.
|
||||||
.SH "EXIT STATUS"
|
.SH "EXIT STATUS"
|
||||||
.
|
.
|
||||||
|
@ -137,7 +137,7 @@ del_transient_ports () {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
start_ovsdb () {
|
do_start_ovsdb () {
|
||||||
check_force_cores
|
check_force_cores
|
||||||
|
|
||||||
if daemon_is_running ovsdb-server; then
|
if daemon_is_running ovsdb-server; then
|
||||||
@ -185,6 +185,12 @@ start_ovsdb () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_ovsdb() {
|
||||||
|
if test X"$OVSDB_SERVER" = Xyes; then
|
||||||
|
do_start_ovsdb
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
add_managers () {
|
add_managers () {
|
||||||
# Now that ovs-vswitchd has started and completed its initial
|
# Now that ovs-vswitchd has started and completed its initial
|
||||||
# configuration, tell ovsdb-server to conenct to the remote managers. We
|
# configuration, tell ovsdb-server to conenct to the remote managers. We
|
||||||
@ -198,7 +204,7 @@ add_managers () {
|
|||||||
db:Open_vSwitch,Open_vSwitch,manager_options
|
db:Open_vSwitch,Open_vSwitch,manager_options
|
||||||
}
|
}
|
||||||
|
|
||||||
start_forwarding () {
|
do_start_forwarding () {
|
||||||
check_force_cores
|
check_force_cores
|
||||||
|
|
||||||
insert_mod_if_required || return 1
|
insert_mod_if_required || return 1
|
||||||
@ -225,16 +231,26 @@ start_forwarding () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_forwarding () {
|
||||||
|
if test X"$OVS_VSWITCHD" = Xyes; then
|
||||||
|
do_start_forwarding
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
## ---- ##
|
## ---- ##
|
||||||
## stop ##
|
## stop ##
|
||||||
## ---- ##
|
## ---- ##
|
||||||
|
|
||||||
stop_ovsdb () {
|
stop_ovsdb () {
|
||||||
stop_daemon ovsdb-server
|
if test X"$OVSDB_SERVER" = Xyes; then
|
||||||
|
stop_daemon ovsdb-server
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_forwarding () {
|
stop_forwarding () {
|
||||||
stop_daemon ovs-vswitchd
|
if test X"$OVS_VSWITCHD" = Xyes; then
|
||||||
|
stop_daemon ovs-vswitchd
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@ -284,12 +300,16 @@ save_interfaces () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
flow_restore_wait () {
|
flow_restore_wait () {
|
||||||
ovs_vsctl set open_vswitch . other_config:flow-restore-wait="true"
|
if test X"$OVS_VSWITCHD" = Xyes; then
|
||||||
|
ovs_vsctl set open_vswitch . other_config:flow-restore-wait="true"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
flow_restore_complete () {
|
flow_restore_complete () {
|
||||||
ovs_vsctl --if-exists remove open_vswitch . other_config \
|
if test X"$OVS_VSWITCHD" = Xyes; then
|
||||||
flow-restore-wait="true"
|
ovs_vsctl --if-exists remove open_vswitch . other_config \
|
||||||
|
flow-restore-wait="true"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
restore_flows () {
|
restore_flows () {
|
||||||
@ -318,6 +338,12 @@ init_restore_scripts () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
force_reload_kmod () {
|
force_reload_kmod () {
|
||||||
|
|
||||||
|
if test X"$OVS_VSWITCHD" != Xyes; then
|
||||||
|
log_failure_msg "Reloading of kmod without ovs-vswitchd is an error"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
ifaces=`internal_interfaces`
|
ifaces=`internal_interfaces`
|
||||||
action "Detected internal interfaces: $ifaces" true
|
action "Detected internal interfaces: $ifaces" true
|
||||||
|
|
||||||
@ -377,7 +403,9 @@ force_reload_kmod () {
|
|||||||
restart () {
|
restart () {
|
||||||
if daemon_is_running ovsdb-server && daemon_is_running ovs-vswitchd; then
|
if daemon_is_running ovsdb-server && daemon_is_running ovs-vswitchd; then
|
||||||
init_restore_scripts
|
init_restore_scripts
|
||||||
save_flows_if_required
|
if test X"$OVS_VSWITCHD" = Xyes; then
|
||||||
|
save_flows_if_required
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restart the database first, since a large database may take a
|
# Restart the database first, since a large database may take a
|
||||||
@ -459,6 +487,8 @@ set_defaults () {
|
|||||||
DAEMON_CWD=/
|
DAEMON_CWD=/
|
||||||
FORCE_COREFILES=yes
|
FORCE_COREFILES=yes
|
||||||
MLOCKALL=yes
|
MLOCKALL=yes
|
||||||
|
OVSDB_SERVER=yes
|
||||||
|
OVS_VSWITCHD=yes
|
||||||
OVSDB_SERVER_PRIORITY=-10
|
OVSDB_SERVER_PRIORITY=-10
|
||||||
OVS_VSWITCHD_PRIORITY=-10
|
OVS_VSWITCHD_PRIORITY=-10
|
||||||
OVSDB_SERVER_WRAPPER=
|
OVSDB_SERVER_WRAPPER=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user