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 <[email protected]>
---
 AUTHORS              |    1 +
 utilities/ovs-ctl.8  |    6 ++++++
 utilities/ovs-ctl.in |    8 +++++++-
 3 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 821f780..c547ce2 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -18,6 +18,7 @@ Edward Tomasz NapieraƂa [email protected]
 Ethan Jackson           [email protected]
 Gaetano Catalli         [email protected]
 Glen Gibb               [email protected]
+Gurucharan Shetty       [email protected]
 Hao Zheng               [email protected]
 Ian Campbell            [email protected]
 Jean Tourrilhes         [email protected]
diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8
index 0e41162..5cf139d 100644
--- a/utilities/ovs-ctl.8
+++ b/utilities/ovs-ctl.8
@@ -400,6 +400,12 @@ 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 system-type  and system-version 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 ee6035c..5640ee8 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`
-- 
1.7.5.4

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to