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> --- 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(-) 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 -- 2.14.3 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev