diff mbox series

[ovs-dev,v2] ovs-vsctl: show DPDK version

Message ID 20171224135837.6111-1-mcroce@redhat.com
State Superseded
Headers show
Series [ovs-dev,v2] ovs-vsctl: show DPDK version | expand

Commit Message

Matteo Croce Dec. 24, 2017, 1:58 p.m. UTC
Show DPDK version if Open vSwitch is compiled with DPDK support.
Add a `dpdk_version` column in the datamodel, change ovs-ctl and ovs-dev.py
to populate the field with the right value.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
---
v2: edit ovs-ctl as well

 utilities/ovs-ctl.in       |  7 +++++++
 utilities/ovs-dev.py       | 15 ++++++++++++---
 utilities/ovs-vsctl.c      |  7 +++++++
 vswitchd/vswitch.ovsschema |  7 +++++--
 vswitchd/vswitch.xml       |  4 ++++
 5 files changed, 35 insertions(+), 5 deletions(-)

Comments

Ben Pfaff Dec. 24, 2017, 7:02 p.m. UTC | #1
On Sun, Dec 24, 2017 at 02:58:37PM +0100, Matteo Croce wrote:
> Show DPDK version if Open vSwitch is compiled with DPDK support.
> Add a `dpdk_version` column in the datamodel, change ovs-ctl and ovs-dev.py
> to populate the field with the right value.
> 
> Signed-off-by: Matteo Croce <mcroce@redhat.com>
> ---
> v2: edit ovs-ctl as well

Thank you for the update.

I think that this is likely to cause confusion eventually because it
reports the version of DPDK that ovs-vsctl is linked against.  That
doesn't even make sense because the sole reason that ovs-vsctl is linked
against DPDK is to report the version.

I think it would be more sensible to make ovs-vswitchd set and report
the dpdk version.  That can't go wrong in the same way.

Thanks,

Ben.
Matteo Croce Dec. 25, 2017, 2:17 p.m. UTC | #2
On Sun, Dec 24, 2017 at 8:02 PM, Ben Pfaff <blp@ovn.org> wrote:
> On Sun, Dec 24, 2017 at 02:58:37PM +0100, Matteo Croce wrote:
>> Show DPDK version if Open vSwitch is compiled with DPDK support.
>> Add a `dpdk_version` column in the datamodel, change ovs-ctl and ovs-dev.py
>> to populate the field with the right value.
>>
>> Signed-off-by: Matteo Croce <mcroce@redhat.com>
>> ---
>> v2: edit ovs-ctl as well
>
> Thank you for the update.
>
> I think that this is likely to cause confusion eventually because it
> reports the version of DPDK that ovs-vsctl is linked against.  That
> doesn't even make sense because the sole reason that ovs-vsctl is linked
> against DPDK is to report the version.
>
> I think it would be more sensible to make ovs-vswitchd set and report
> the dpdk version.  That can't go wrong in the same way.
>
> Thanks,
>
> Ben.

That's true. Initially I tought putting the version info in vswitchd
but I didn't want to break anything relying on
'ovs-vswitchd --version' output so I put it in ovs-vsctl as it
already contained another field, the DB version.
I'm making a v3 with the DPDK version in vswitchd and a safer
ovs-ctl/ovs-dev.phy which didn't require the OVS version to be the
first line of output.

Cheers,
diff mbox series

Patch

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index f1b01d1d3..3ce8e1849 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -79,6 +79,13 @@  set_system_ids () {
     OVS_VERSION=`ovs-vswitchd --version | sed 's/.*) //;1q'`
     set "$@" ovs-version="$OVS_VERSION"
 
+    DPDK_VERSION=`ovs-vsctl --version |awk '/^DPDK/{print$2}'`
+    if [ -n "$DPDK_VERSION" ]; then
+        set "$@" dpdk-version="$DPDK_VERSION"
+    else
+        ovs_vsctl clear Open_vSwitch . dpdk_version
+    fi
+
     case $SYSTEM_ID in
         random)
             id_file=$etcdir/system-id.conf
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..7015a2687 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.16.0",
+ "cksum": "654116098 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