Skip to content

Support multiple guest physical networks for KVM trunking - #14937

Draft
Pearl1594 wants to merge 2 commits into
mainfrom
support-multiple-phy-guest-nets-trunking
Draft

Pearl1594 wants to merge 2 commits into
mainfrom
support-multiple-phy-guest-nets-trunking

Conversation

@Pearl1594

Copy link
Copy Markdown
Contributor

Description

The KVM agent's trunk-nic/VLAN-filtering support treated vlan_filtering (and STP) as a single host-wide property. It didn't support vlan unaware bridges (vlan_filtering off ) with vlan aware guest bridges. All guest bridges needed to have vlan_filtering flipped to true.
With multiple Guest physical networks per host, each with its own bridge, a host can legitimately have vlan_filtering enabled on one bridge and not on another.

With this enhancement, one wouldn't have to put the host into maintenance mode and flip the existing guest bridges vlan_filtering setting, but can add a new guest physical network(bridge) to the zone and make it vlan aware, such that VMs on the old guest physical network continue to use the dedicated per vlan bridge topology and those on the new physical network use the shared bridge topo.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

How Has This Been Tested?

This was tested on an 8 host KVM lab spanning 2 guest physical networks(cloudbr1 and cloudbr2), 2 libvirt versions (8.0.0 / 11.10.0), and intentionally mixed per-host vlan_filtering/STP state

  • Ordinary VLAN nic placement on filtered and unfiltered bridges (both libvirt versions)
  • Trunk nic placement, filtered bridge (both libvirt versions), including the manual VLAN-membership fallback on libvirt < 11.0.0 (confirmed via bridge vlan show / absence of domain XML)
  • Live migration: same-libvirt-version and cross-host, including a trunk nic through the manual-membership path on both ends
  • Trunk-nic association, disassociation, and primary-network change (stop/change/start) - bridge and VLAN membership verified via virsh/bridge vlan show after each
  • Deploy-time auto-placement avoidance for VLAN-1 nics (planner correctly avoids filtering-enabled hosts with no explicit host specified)
  • findHostsForMigration suitability matrix for both trunk nics (need filtering-enabled host) and VLAN-1 nics (need legacy host) - exact match to each host's actual bridge state
  • Live associate/add-nic rejected correctly when the current host's bridge doesn't support the requirement, with the correct physical-network-scoped error message
  • Cross-physical-network trunk association still rejected (unaffected, pre-existing validation)
  • STP caution fires only for nics on a bridge with STP on; trunk-XML caution fires only for trunk nics on libvirt < 11.0.0 hosts; neither ever incorrectly overlaps
  • Host details/API consistency: per-physical-network keys, bridge-name resolution, rollup semantics, verified across multiple hosts with differing state
  • UI: list hosts now shows the count of bridges per host that have vlan_filtering on ie, X/Y vlan filtering badge seen when the feature is enabled and has vlan filtering on guest phy bridge on the host.

How did you try to break this feature and the system with this change?

@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.05495% with 100 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.08%. Comparing base (8eaff97) to head (2b8fe81).

Files with missing lines Patch % Lines
...in/java/com/cloud/server/ManagementServerImpl.java 0.00% 32 Missing ⚠️
...tack/engine/orchestration/NetworkOrchestrator.java 0.00% 16 Missing ⚠️
.../java/com/cloud/api/query/dao/HostJoinDaoImpl.java 0.00% 14 Missing ⚠️
...om/cloud/deploy/DeploymentPlanningManagerImpl.java 65.21% 3 Missing and 5 partials ⚠️
...g/apache/cloudstack/api/response/HostResponse.java 0.00% 6 Missing ⚠️
...ain/java/com/cloud/network/NetworkServiceImpl.java 50.00% 2 Missing and 3 partials ⚠️
...cloud/hypervisor/kvm/resource/BridgeVifDriver.java 66.66% 1 Missing and 2 partials ⚠️
...resource/wrapper/LibvirtMigrateCommandWrapper.java 78.57% 0 Missing and 3 partials ⚠️
...pper/LibvirtPrepareForMigrationCommandWrapper.java 40.00% 2 Missing and 1 partial ⚠️
...i/command/admin/host/FindHostsForMigrationCmd.java 0.00% 2 Missing ⚠️
... and 5 more
Additional details and impacted files
@@             Coverage Diff              @@
##              main   #14937       +/-   ##
============================================
+ Coverage     3.86%   21.08%   +17.21%     
- Complexity       0    21293    +21293     
============================================
  Files          494     6058     +5564     
  Lines        42890   549979   +507089     
  Branches      8142    78329    +70187     
============================================
+ Hits          1657   115954   +114297     
- Misses       41001   420387   +379386     
- Partials       232    13638    +13406     
Flag Coverage Δ
uitests 3.86% <ø> (-0.01%) ⬇️
unittests 22.54% <45.05%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Pearl1594
Pearl1594 force-pushed the support-multiple-phy-guest-nets-trunking branch from 236f77c to 2b8fe81 Compare December 1, 2026 21:51
@sonarqubecloud

sonarqubecloud Bot commented Dec 1, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
39.0% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 26.11%
Branch coverage 21.31%

Grade Scale

Grade Line Coverage Meaning
🟢 A ≥ 80% Excellent - this code sleeps well at night 😴
🟡 B 60-79% Good - almost there, don't stop now 😉
🟠 C 40-59% Acceptable - your code is wearing a seatbelt, but no airbags 😬
🔴 D 20-39% Marginal - boldly shipping where no test has gone before 🖖
⛔ F < 20% Failing - tests? what tests? 🔥

Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run

@Pearl1594

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@Pearl1594 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20257

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants