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 <mcr...@redhat.com> --- utilities/ovs-ctl.in | 9 ++++++++- utilities/ovs-dev.py | 7 +++++++ vswitchd/ovs-vswitchd.c | 7 +++++++ vswitchd/vswitch.ovsschema | 7 +++++-- vswitchd/vswitch.xml | 4 ++++ 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index f1b01d1d3..1e334de2b 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -76,9 +76,16 @@ set_hostname () { set_system_ids () { set ovs_vsctl set Open_vSwitch . - OVS_VERSION=`ovs-vswitchd --version | sed 's/.*) //;1q'` + OVS_VERSION=`ovs-vswitchd --version |awk '/Open vSwitch/{print $NF}'` set "$@" ovs-version="$OVS_VERSION" + DPDK_VERSION=`ovs-vswitchd --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..70170e21d 100755 --- a/utilities/ovs-dev.py +++ b/utilities/ovs-dev.py @@ -284,9 +284,16 @@ def run(): "other_config:dpdk-init=true" % root_uuid) _sh("ovs-vsctl --no-wait set Open_vSwitch %s other_config:" "dpdk-extra=\"%s\"" % (root_uuid, ' '.join(options.dpdk))) + dpdk_version = _sh("ovs-vswitchd --version", capture=True) + dpdk_version = [s for s in dpdk_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)) else: _sh("ovs-vsctl --no-wait set Open_vSwitch %s " "other_config:dpdk-init=false" % root_uuid) + _sh("ovs-vsctl --no-wait clear Open_vSwitch %s dpdk_version" % root_uuid) if options.gdb: cmd = ["gdb", "--args"] + cmd diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index d5e07c037..e033a7d1f 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -25,6 +25,10 @@ #include <sys/mman.h> #endif +#ifdef DPDK_NETDEV +#include <rte_version.h> +#endif + #include "bridge.h" #include "command-line.h" #include "compiler.h" @@ -187,6 +191,9 @@ parse_options(int argc, char *argv[], char **unixctl_pathp) case 'V': ovs_print_version(0, 0); +#ifdef DPDK_NETDEV + puts(rte_version()); +#endif exit(EXIT_SUCCESS); case OPT_MLOCKALL: 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 -- 2.14.3 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev