On 22/12/17 11:53, Matteo Croce wrote:
Show DPDK version if Open vSwitch is compiled with DPDK support.
Add a `dpdk_version` column in the datamodel and also edit ovs-dev.py to
populate the field with the right value.

Signed-off-by: Matteo Croce <[email protected]>
---
  utilities/ovs-dev.py       | 15 ++++++++++++---
  utilities/ovs-vsctl.c      |  7 +++++++
  vswitchd/vswitch.ovsschema |  7 +++++--
  vswitchd/vswitch.xml       |  4 ++++
  4 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py
index 9ce0f04c7..1bc0ba8c7 100755
--- a/utilities/ovs-dev.py
+++ b/utilities/ovs-dev.py
@@ -270,11 +270,20 @@ def run():
          " %s/ovsclient-cert.pem %s/vswitchd.cacert"
          % (pki_dir, pki_dir, pki_dir))
      version = _sh("ovs-vsctl --no-wait --version", capture=True)
-    version = version[0].decode().strip().split()[3]
      root_uuid = _sh("ovs-vsctl --no-wait --bare list Open_vSwitch",
                      capture=True)[0].decode().strip()
-    _sh("ovs-vsctl --no-wait set Open_vSwitch %s ovs_version=%s"
-        % (root_uuid, version))
+
+    ovs_version = [s for s in version if "Open vSwitch" in s]
+    if ovs_version:
+        ovs_version = ovs_version[0].decode().strip().split()[3]
+        _sh("ovs-vsctl --no-wait set Open_vSwitch %s ovs_version=%s"
+            % (root_uuid, ovs_version))
+
+    dpdk_version = [s for s in version if "DPDK" in s]
+    if dpdk_version:
+        dpdk_version = dpdk_version[0].decode().strip().split()[1]
+        _sh("ovs-vsctl --no-wait set Open_vSwitch %s dpdk_version=%s"
+            % (root_uuid, dpdk_version))
build = BUILD_CLANG if options.clang else BUILD_GCC
      cmd = [build + "/vswitchd/ovs-vswitchd"]
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 7b909431d..f830120ad 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -27,6 +27,10 @@
  #include <string.h>
  #include <unistd.h>
+#ifdef DPDK_NETDEV
+#include <rte_version.h>
+#endif
+
  #include "db-ctl-base.h"
#include "command-line.h"
@@ -304,6 +308,9 @@ parse_options(int argc, char *argv[], struct shash 
*local_options)
          case 'V':
              ovs_print_version(0, 0);
              printf("DB Schema %s\n", ovsrec_get_db_version());
+#ifdef DPDK_NETDEV
+            printf("%s\n", rte_version());
+#endif
              exit(EXIT_SUCCESS);
case 't':
diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema
index 90e50b626..757d8ec17 100644
--- a/vswitchd/vswitch.ovsschema
+++ b/vswitchd/vswitch.ovsschema
@@ -1,6 +1,6 @@
  {"name": "Open_vSwitch",
- "version": "7.15.1",
- "cksum": "3682332033 23608",
+ "version": "7.15.2",
+ "cksum": "3876676959 23718",
   "tables": {
     "Open_vSwitch": {
       "columns": {
@@ -36,6 +36,9 @@
         "db_version": {
           "type": {"key": {"type": "string"},
                    "min": 0, "max": 1}},
+       "dpdk_version": {
+         "type": {"key": {"type": "string"},
+                  "min": 0, "max": 1}},
         "system_type": {
           "type": {"key": {"type": "string"},
                    "min": 0, "max": 1}},
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 37d04b7cf..74890f72b 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -611,6 +611,10 @@
          </p>
        </column>
+ <column name="dpdk_version">
+        DPDK version number, e.g. <code>17.11</code>.
+      </column>
+
        <column name="system_type">
          <p>
            An identifier for the type of system on top of which Open vSwitch

Changes look good to me.

Reviewed-by: Eelco Chaudron <[email protected]>

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to