diff options
author | Gurucharan Shetty <gshetty@nicira.com> | 2012-01-05 18:28:20 -0800 |
---|---|---|
committer | Gurucharan Shetty <gshetty@nicira.com> | 2012-01-09 17:58:39 -0800 |
commit | a685eb5a760579f0fe45cf5e5fe8db93468cb91d (patch) | |
tree | 8730d0ab928038ca244dc866658b21acd6ec30ed | |
parent | 551a2f6ca9a90a577bc25cdd913f6df6bd8d9b23 (diff) |
ovs-ctl: Pull system_type and system_version from config file
Currently system-type and system-version can only be set through
ovs-vsctl and ovs-ctl in the commandline. This patch allows you
to place system-type.conf and system-version.conf files in $etcdir
and their contents will be used if no arguments are specified with
ovs-vsctl or ovs-ctl.
Bug #9033.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | utilities/ovs-ctl.8 | 15 | ||||
-rwxr-xr-x | utilities/ovs-ctl.in | 8 |
3 files changed, 20 insertions, 4 deletions
@@ -18,6 +18,7 @@ Edward Tomasz NapieraĆa trasz@freebsd.org Ethan Jackson ethan@nicira.com Gaetano Catalli gaetano.catalli@gmail.com Glen Gibb grg@stanford.edu +Gurucharan Shetty gshetty@nicira.com Hao Zheng hzheng@nicira.com Ian Campbell Ian.Campbell@citrix.com Jean Tourrilhes jt@hpl.hp.com diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8 index 0e411620..658cbd6b 100644 --- a/utilities/ovs-ctl.8 +++ b/utilities/ovs-ctl.8 @@ -124,9 +124,8 @@ ID that persists from one run to another (stored in a file). When another string is specified \fBovs\-ctl\fR uses it literally. . .PP -On systems that have the \fBlsb_release\fR program, \fBovs\-ctl\fR -chooses reasonable defaults for the following options. Other systems -should specify values: +The following options should be specified if the defaults are not +suitable: . .IP "\fB\-\-system\-type=\fItype\fR" .IQ "\fB\-\-system\-version=\fIversion\fR" @@ -135,6 +134,11 @@ Sets the value to store in the \fBsystem-type\fR and \fBOpen_vSwitch\fR table. Remote managers may use these values to determine the kind of system to which they are connected (primarily for display to human administrators). +.IP +When not specified, \fBovs\-ctl\fR uses values from the optional +\fBsystem\-type.conf\fR and \fBsystem\-version.conf\fR files(see section +\fBFILES\fR) or it uses the \fBlsb_release\fR program, if present, to +provide reasonable defaults. . .PP The following options are also likely to be useful: @@ -400,6 +404,11 @@ location). The persistent system UUID created and read by \fB\-\-system\-id=random\fR. . +.IP "\fIsysconfdir\fB/openvswitch/system\-type.conf\fR" +.IQ "\fIsysconfdir\fB/openvswitch/system\-version.conf\fR" +The \fBsystem\-type\fR and \fBsystem\-version\fR values stored in the database's +\fBOpen_vSwitch\fR table when not specified as a command-line option. +. .SH "EXAMPLE" . .PP diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index ee6035c0..5640ee88 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -373,7 +373,13 @@ set_defaults () { DPORT= SPORT= - if (lsb_release --id) >/dev/null 2>&1; then + type_file=$etcdir/system-type.conf + version_file=$etcdir/system-version.conf + + if test -e "$type_file" ; then + SYSTEM_TYPE=`cat $type_file` + SYSTEM_VERSION=`cat $version_file` + elif (lsb_release --id) >/dev/null 2>&1; then SYSTEM_TYPE=`lsb_release --id -s` system_release=`lsb_release --release -s` system_codename=`lsb_release --codename -s` |