Skip to content

Routed: get vm network statistics on Routed network#13105

Draft
weizhouapache wants to merge 2 commits intoapache:4.22from
weizhouapache:4.22-routed-network-statictics
Draft

Routed: get vm network statistics on Routed network#13105
weizhouapache wants to merge 2 commits intoapache:4.22from
weizhouapache:4.22-routed-network-statictics

Conversation

@weizhouapache
Copy link
Copy Markdown
Member

Description

This PR fixes #11299

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.68%. Comparing base (5b9a3d7) to head (729cb0c).
⚠️ Report is 4 commits behind head on 4.22.

Files with missing lines Patch % Lines
...src/main/java/com/cloud/server/StatsCollector.java 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #13105   +/-   ##
=========================================
  Coverage     17.67%   17.68%           
- Complexity    15791    15793    +2     
=========================================
  Files          5922     5922           
  Lines        533085   533091    +6     
  Branches      65205    65209    +4     
=========================================
+ Hits          94243    94269   +26     
+ Misses       428204   428180   -24     
- Partials      10638    10642    +4     
Flag Coverage Δ
uitests 3.69% <ø> (ø)
unittests 18.75% <0.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the management server’s periodic VM network statistics collection logic (StatsCollector) to include routed guest networks (in addition to shared/direct-attached networks), addressing issue #11299.

Changes:

  • Extend VM network stats interval config descriptions to mention both Shared and Routed networks.
  • Update the VM network stats collection filter to accept routed networks (via RoutedIpv4Manager.isRoutedNetwork(...)) in addition to direct-attached VLAN networks.
  • Inject NetworkDao and RoutedIpv4Manager into StatsCollector to support routed-network detection during stats collection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/src/main/java/com/cloud/server/StatsCollector.java Outdated
Comment thread server/src/main/java/com/cloud/server/StatsCollector.java Outdated
Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@sureshanaparti
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware 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 17717

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment on lines 1591 to +1596
NicVO nic = _nicDao.search(sc_nic, null).get(0);
List<VlanVO> vlan = _vlanDao.listVlansByNetworkId(nic.getNetworkId());
if (vlan == null || vlan.size() == 0 || vlan.get(0).getVlanType() != VlanType.DirectAttached)
continue; // only get network statistics for DirectAttached network (shared networks in Basic zone and Advanced zone with/without SG)
NetworkVO networkVO = networkDao.findById(nic.getNetworkId());
boolean isRoutedNetwork = networkVO != null && routedIpv4Manager.isRoutedNetwork(networkVO);
boolean isDirectAttachedNetwork = CollectionUtils.isNotEmpty(vlan)
&& vlan.get(0).getVlanType() == VlanType.DirectAttached;
Comment on lines +1593 to +1599
NetworkVO networkVO = networkDao.findById(nic.getNetworkId());
boolean isRoutedNetwork = networkVO != null && routedIpv4Manager.isRoutedNetwork(networkVO);
boolean isDirectAttachedNetwork = CollectionUtils.isNotEmpty(vlan)
&& vlan.get(0).getVlanType() == VlanType.DirectAttached;
if (!isRoutedNetwork && !isDirectAttachedNetwork) {
continue; // only get network statistics for Shared or Routed network
}
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.

4 participants