Skip to content

Conversation

@Rubueno
Copy link
Contributor

@Rubueno Rubueno commented Apr 1, 2025

Description

This PR fixes a minor bug in the libvirt domain xml concering the interface bandwidth. In a libvirt domain xml when nw_rate=5000 the kilobytes per second configured in the interface is 640000 which is 5.12 Gbit/s. Which is more than the configured network rate of 5Gbit/s. So instead multiply by 125 (1 Megabit = 125 Kilobyte). 5000 * 125 = 625000 KB/s = 5Gbit/s

QoS is defined in Kilobytes per second according to libvirt docs

average
Specifies the desired average bit rate for the interface being shaped (in kilobytes/second).

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

How Has This Been Tested?

Untested, but the change is trivial.

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

N/A

@wido wido self-requested a review April 1, 2025 14:50
Copy link
Contributor

@wido wido left a comment

Choose a reason for hiding this comment

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

Change looks good. We need to multiple by 125 when working with Bits. If it would be bytes we would need to convert with 128.

This change looks good to make the proper calculation.

LGTM

@DaanHoogland
Copy link
Contributor

@Rubueno , i am assuming you are testing this in production, are you? ;)

@codecov
Copy link

codecov bot commented Apr 2, 2025

Codecov Report

❌ Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.36%. Comparing base (2dfe6a6) to head (eaa964f).
⚠️ Report is 403 commits behind head on main.

Files with missing lines Patch % Lines
...m/cloud/hypervisor/kvm/resource/VifDriverBase.java 60.00% 1 Missing and 1 partial ⚠️
...cloud/hypervisor/kvm/resource/DirectVifDriver.java 0.00% 1 Missing ⚠️
...om/cloud/hypervisor/kvm/resource/IvsVifDriver.java 0.00% 1 Missing ⚠️
...om/cloud/hypervisor/kvm/resource/OvsVifDriver.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #10645      +/-   ##
============================================
+ Coverage     16.30%   17.36%   +1.05%     
- Complexity    13448    15235    +1787     
============================================
  Files          5674     5885     +211     
  Lines        499203   525624   +26421     
  Branches      60369    64152    +3783     
============================================
+ Hits          81408    91257    +9849     
- Misses       408726   424072   +15346     
- Partials       9069    10295    +1226     
Flag Coverage Δ
uitests 3.63% <ø> (-0.37%) ⬇️
unittests 18.40% <44.44%> (+1.23%) ⬆️

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.

In a libvirt domain xml when nw_rate=5000 the kilobytes per second
configured in the interface is 640000 which is 5.12 Gbit/s. Which is
more than the configured network rate of 5Gbit/s. So instead multiply by
125.
Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland 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

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

Copy link
Collaborator

@rosi-shapeblue rosi-shapeblue left a comment

Choose a reason for hiding this comment

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

LGTM - All functional, edge, and lifecycle scenarios pass; fix verified.

Test Cases Covered & Status

  • NetworkRate-50Mbps

    • Expected: 6250 Kbps (50×125)
    • Status: PASS
  • NetworkRate-100Mbps

    • Expected: 12500 Kbps (100×125)
    • Status: PASS
  • NetworkRate-500Mbps

    • Expected: 62500 Kbps (500×125)
    • Status: PASS
  • NetworkRate-ZeroRate

    • Expected: No bandwidth tags
    • Status: PASS
  • CrossHost-Consistency

    • Expected: Same values across KVM hosts
    • Status: PASS
  • EdgeCase-Handling

    • Expected: Zero rate properly handled
    • Status: PASS
  • Negative/Invalid-Input

    • Expected: Handled gracefully (error/no effect)
    • Status: PASS
  • Instance Lifecycle Retest

    • Expected: Same values after destroy & redeploy
    • Status: PASS
  • Hot-Update Check

    • Expected: XML updates correctly on rate change
    • Status: PASS

Evidence - libvirt XML Dumps

- 100 Mbps Instance: - inbound/outbound average=12500 peak=12500

<interface type='bridge'>
  <mac address='02:01:00:cd:00:04'/>
  <source bridge='breth1-1639'/>
  <bandwidth>
    <inbound average='12500' peak='12500'/>
    <outbound average='12500' peak='12500'/>
  </bandwidth>
  <target dev='vnet9'/>
  <model type='virtio'/>
</interface>
  • 50 Mbps Instance: - inbound/outbound average=6250 peak=6250
<interface type='bridge'>
  <mac address='02:01:00:cd:00:03'/>
  <source bridge='breth1-1639'/>
  <bandwidth>
    <inbound average='6250' peak='6250'/>
    <outbound average='6250' peak='6250'/>
  </bandwidth>
  <target dev='vnet2'/>
  <model type='virtio'/>
</interface>
  • 500 Mbps Instance: - inbound/outbound average=62500 peak=62500
<interface type='bridge'>
  <mac address='02:01:00:cd:00:05'/>
  <source bridge='breth1-1639'/>
  <bandwidth>
    <inbound average='62500' peak='62500'/>
    <outbound average='62500' peak='62500'/>
  </bandwidth>
  <target dev='vnet3'/>
  <model type='virtio'/>
</interface>
  • Zero Rate Instance: - No bandwidth section found - correctly handled zero rate case
[root@kvm1 ~]# virsh dumpxml i-2-9-VM | grep -A5 -B5 bandwidth
[root@kvm1 ~]#

- Original Instance, confirming New Factor (5000 Mbps): - inbound/outbound average=625000 peak=625000

  • 5000 Mbps × 125 = 625,000 Kbps (confirms new factor working)
<interface type='bridge'>
  <mac address='02:01:00:cd:00:01'/>
  <source bridge='breth1-1639'/>
  <bandwidth>
    <inbound average='625000' peak='625000'/>
    <outbound average='625000' peak='625000'/>
  </bandwidth>
  <target dev='vnet1'/>
  <model type='virtio'/>
</interface>

@rosi-shapeblue
Copy link
Collaborator

@blueorangutan test

@blueorangutan
Copy link

@rosi-shapeblue a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

Co-authored-by: Suresh Kumar Anaparti <[email protected]>
Copy link
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
Contributor

@blueorangutan package

@blueorangutan
Copy link

@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

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

@sureshanaparti sureshanaparti merged commit e57e8cf into apache:main Aug 11, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Apache CloudStack 4.21.0 Aug 11, 2025
@blueorangutan
Copy link

[SF] Trillian test result (tid-14050)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 54002 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10645-t14050-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Sep 4, 2025
* Network rate must be multiplied by 125 not 128

In a libvirt domain xml when nw_rate=5000 the kilobytes per second
configured in the interface is 640000 which is 5.12 Gbit/s. Which is
more than the configured network rate of 5Gbit/s. So instead multiply by
125.

* Apply suggestions from code review

Co-authored-by: Suresh Kumar Anaparti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants