debian: Store more system information in OVSDB.
authorJustin Pettit <jpettit@nicira.com>
Mon, 7 Feb 2011 19:44:54 +0000 (11:44 -0800)
committerJustin Pettit <jpettit@nicira.com>
Mon, 7 Feb 2011 21:43:42 +0000 (13:43 -0800)
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

index 96eb00cf89b393e1e34b2c9fe0de9e98ae560e80..60cc369f54a376bb541cff089ac6645c72e65e86 100755 (executable)
@@ -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 (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`
+        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