[ovs-dev] [PATCH 2/2] debian: Store more system information in OVSDB.

Justin Pettit jpettit at nicira.com
Mon Feb 7 19:48:37 UTC 2011


Store the OVS version in OVSDB.  Additionally, if the "lsb_release"
command is available, store information about the system type and
version.

Bug #4576
---
 debian/openvswitch-switch.init |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/debian/openvswitch-switch.init b/debian/openvswitch-switch.init
index 96eb00c..f9b0094 100755
--- a/debian/openvswitch-switch.init
+++ b/debian/openvswitch-switch.init
@@ -193,6 +193,23 @@ unload_modules() {
     unload_module openvswitch_mod
 }
 
+set_system_info() {
+    ovs_version=`ovs-vswitchd --version | sed 's/.*) //;1q'`
+    ovs-vsctl --no-wait --timeout=5 set Open_vSwitch . \
+        ovs-version="$ovs_version"
+
+    if [ `which lsb_release` ]; then
+        system_type=`lsb_release --id -s`
+        system_release=`lsb_release --release -s`
+        system_codename=`lsb_release --codename -s`
+        system_version="${system_release}-${system_codename}"
+
+        ovs-vsctl --no-wait --timeout=5 set Open_vSwitch . \
+            system-type="$system_type" \
+            system-version="$system_version"
+    fi
+}
+
 case "$1" in
     start)
         conf_file=/etc/openvswitch/conf.db
@@ -264,6 +281,8 @@ case "$1" in
 
         ovs-vsctl --no-wait --timeout=5 init -- set Open_vSwitch . db-version="$schema_ver"
 
+        set_system_info
+
         # Start ovs-vswitchd.
         set --
         set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err
-- 
1.7.1





More information about the dev mailing list