Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Add intelligent version detection for OVS 3.x+#10

Merged
greenpau merged 14 commits intogreenpau:mainfrom
lucadelmonte:fix/ovs3-version-detection
Dec 28, 2025
Merged

Add intelligent version detection for OVS 3.x+#10
greenpau merged 14 commits intogreenpau:mainfrom
lucadelmonte:fix/ovs3-version-detection

Conversation

@lucadelmonte
Copy link
Copy Markdown
Contributor

@lucadelmonte lucadelmonte commented Dec 23, 2025

Motivation

In Open vSwitch 3.x+, the fields ovs_version, db_version, system_type, and system_version are no longer written to the Open_vSwitch database. The current code treats these missing fields as errors, logging warnings and reducing observability for OVS 3.x+ deployments.

Problem

When these fields are missing from the database, the code currently fails to populate them, even though the information is readily available through other channels:

  • OVS version via ovs-appctl version
  • Database schema version (already queried)
  • System type and version from /etc/os-release

This creates unnecessary error logs and makes monitoring OVS versions across infrastructure more difficult.

Solution

This PR enhances version detection to intelligently gather information from multiple sources:

  1. OVS Version: Query via ovs-appctl version using existing socket control infrastructure
  2. DB Version: Extract from database schema
  3. System Type/Version: Read from /etc/os-release

Falls back gracefully only when queries actually fail.

Implementation

  • Uses existing Client.query() infrastructure for consistency
  • Adds helper functions: getVersionViaAppctl(), parseOvsVersion(), getSystemInfoFromOS()
  • Maintains backward compatibility with OVS 2.x
  • Includes comprehensive unit tests

Results

Before (OVS 3.5.1): Error logs for missing fields

After (OVS 3.5.1): ovs_version: 3.5.1 db_version: 8.4.0 system_type: ubuntu system_version: 24.04

This improves observability for OVS 3.x+ while maintaining full backward compatibility.


  • Query ovs-appctl for OVS version when missing from DB
  • Get db_version from schema instead of defaulting to 'unknown'
  • Read system_type and system_version from /etc/os-release
  • Only use 'unknown' as final fallback when queries fail
  • Add comprehensive tests for new functions

- Query ovs-appctl for OVS version when missing from DB
- Get db_version from schema instead of defaulting to 'unknown'
- Read system_type and system_version from /etc/os-release
- Only use 'unknown' as final fallback when queries fail
- Add comprehensive tests for new functions
@lucadelmonte
Copy link
Copy Markdown
Contributor Author

@greenpau updated the linter and fixed lint errors/ignored the ones i was not sure if i would break something, also fixed a test that was failing when using newer version of ovs

Add version command support and enhance OvnChassis structure with NbCfg and NbCfgTimestamp fields
@greenpau greenpau merged commit cb1dde6 into greenpau:main Dec 28, 2025
1 check passed
@greenpau
Copy link
Copy Markdown
Owner

@lucadelmonte , thank you for contributing! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants