Change the global configuration vm.network.throttling.rate to be dynamic#12567
Change the global configuration vm.network.throttling.rate to be dynamic#12567gruckbit wants to merge 4 commits into
vm.network.throttling.rate to be dynamic#12567Conversation
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
|
@blueorangutan package |
|
@bernardodemarco 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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12567 +/- ##
=========================================
Coverage 18.11% 18.11%
- Complexity 16757 16761 +4
=========================================
Files 6037 6037
Lines 542783 542783
Branches 66454 66454
=========================================
+ Hits 98301 98348 +47
+ Misses 433438 433387 -51
- Partials 11044 11048 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16676 |
DaanHoogland
left a comment
There was a problem hiding this comment.
clgtm and malkes functional sense
|
btw @gruckbit , if you feel this would benefit older release branches as well feel free to rebase on 4.20 or 4.22. |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-15364)
|
Sure, I'll check later if the changes could be applied to these versions as well. |
| ConfigKey<Boolean> NSX_ENABLED = new ConfigKey<>(Boolean.class, "nsx.plugin.enable", "Advanced", "false", | ||
| "Indicates whether to enable the NSX plugin", false, ConfigKey.Scope.Zone, null); | ||
|
|
||
| ConfigKey<Integer> VmNetworkThrottlingRate = new ConfigKey<Integer>("Network", Integer.class, "vm.network.throttling.rate", "200", |
There was a problem hiding this comment.
maybe extent to a zone-level setting ?
similar to
ConfigKey<Integer> NetworkThrottlingRate = new ConfigKey<>("Network", Integer.class, NetworkThrottlingRateCK, "200",
"Default data transfer rate in megabits per second allowed in network.", true, ConfigKey.Scope.Zone);
There was a problem hiding this comment.
Sure, I'll check this suggestion as well.
kiranchavala
left a comment
There was a problem hiding this comment.
LGTM
Tested manually
-
Create a network offering with no "Network rate (Mb/s)"
-
Create a network with the above network offering
-
Make sure the global setting "vm.network.throttling.rate" is set to 200
-
Deploy a vm
-
Login to the kvm host where the vm is deployed and check the bandwidth and rate limit
[root@ref-trl-11266-k-Mol8-kiran-chavala-kvm1 ~]# virsh dumpxml 4 | grep -A10 interface
<interface type='bridge'>
<mac address='02:01:00:cc:00:01'/>
<source bridge='breth1-1808'/>
<bandwidth>
<inbound average='25000' peak='25000'/>
<outbound average='25000' peak='25000'/>
</bandwidth>
<target dev='vnet9'/>
<model type='virtio'/>
<link state='up'/>
<alias name='net0'/>
[root@ref-trl-11266-k-Mol8-kiran-chavala-kvm1 ~]# virsh domiflist 4
Interface Type Source Model MAC
----------------------------------------------------------------
vnet9 bridge breth1-1808 virtio 02:01:00:cc:00:01
[root@ref-trl-11266-k-Mol8-kiran-chavala-kvm1 ~]# tc class show dev vnet9
class htb 1:1 root leaf 2: prio 0 rate 200Mbit ceil 200Mbit burst 1600b cburst 1600b
-
Change the global setting "vm.network.throttling.rate" is set to 400
-
Stop/Start the vm
-
Check the the bandwidth and rate limit
[root@ref-trl-11266-k-Mol8-kiran-chavala-kvm1 ~]# virsh dumpxml 5 | grep -A10 interface
<interface type='bridge'>
<mac address='02:01:00:cc:00:01'/>
<source bridge='breth1-1808'/>
<bandwidth>
<inbound average='50000' peak='50000'/>
<outbound average='50000' peak='50000'/>
</bandwidth>
<target dev='vnet10'/>
<model type='virtio'/>
<link state='up'/>
<alias name='net0'/>
[root@ref-trl-11266-k-Mol8-kiran-chavala-kvm1 ~]# virsh domiflist 5
Interface Type Source Model MAC
----------------------------------------------------------------
vnet10 bridge breth1-1808 virtio 02:01:00:cc:00:01
[root@ref-trl-11266-k-Mol8-kiran-chavala-kvm1 ~]# tc class show dev vnet10
class htb 1:1 root leaf 2: prio 0 rate 400Mbit ceil 400Mbit burst 1600b cburst 1600b
|
@gruckbit Please let us know if you can extend the feature to zone-level setting Otherwise the pr is ready for merge |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
@gruckbit could you have a look at Kiran's suggestion in #12567 (comment)? |
| PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RollingRestartEnabled, | ||
| TUNGSTEN_ENABLED, NSX_ENABLED, NETRIS_ENABLED, NETWORK_LB_HAPROXY_MAX_CONN, | ||
| NETWORK_LB_HAPROXY_IDLE_TIMEOUT}; | ||
| TUNGSTEN_ENABLED, NSX_ENABLED, NETRIS_ENABLED, NETWORK_LB_HAPROXY_MAX_CONN, VmNetworkThrottlingRate}; |
There was a problem hiding this comment.
maybe move after NetworkThrottlingRate
There was a problem hiding this comment.
Ok, understood. I'll try to extend this feature to the zone level as required.
| "Indicates whether to enable the NSX plugin", false, ConfigKey.Scope.Zone, null); | ||
|
|
||
| ConfigKey<Integer> VmNetworkThrottlingRate = new ConfigKey<Integer>("Network", Integer.class, "vm.network.throttling.rate", "200", | ||
| "Default data transfer rate in megabits per second allowed in User vm's default network.", true); |
There was a problem hiding this comment.
NetworkThrottlingRate is a zone-level configuration, this could be zone-level too
There was a problem hiding this comment.
Pull request overview
This PR makes the global configuration vm.network.throttling.rate dynamic so Management Server restarts are no longer required for changes to take effect when applying default NIC bandwidth limits for user VMs.
Changes:
- Replaces direct
_configDaolookups with aConfigKey-backed value forvm.network.throttling.rate. - Removes
VmNetworkThrottlingRatefrom the legacyConfigenum and redefines it as a dynamicConfigKeyunderNetworkOrchestrationService. - Registers the new config key via
NetworkOrchestrator#getConfigKeys().
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java |
Switches default VM throttling rate retrieval to ConfigKey.value() to support dynamic updates. |
server/src/main/java/com/cloud/configuration/Config.java |
Removes the legacy VmNetworkThrottlingRate enum entry (migrating responsibility to ConfigKey). |
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java |
Updates config key registration list to include the new VmNetworkThrottlingRate (but currently drops an existing key—see comment). |
engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java |
Introduces dynamic ConfigKey<Integer> VmNetworkThrottlingRate. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return new ConfigKey<?>[]{NetworkGcWait, NetworkGcInterval, NetworkLockTimeout, DeniedRoutes, | ||
| GuestDomainSuffix, NetworkThrottlingRate, MinVRVersion, | ||
| PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RollingRestartEnabled, | ||
| TUNGSTEN_ENABLED, NSX_ENABLED, NETRIS_ENABLED, NETWORK_LB_HAPROXY_MAX_CONN, | ||
| NETWORK_LB_HAPROXY_IDLE_TIMEOUT}; | ||
| TUNGSTEN_ENABLED, NSX_ENABLED, NETRIS_ENABLED, NETWORK_LB_HAPROXY_MAX_CONN, VmNetworkThrottlingRate}; |
Description
ACS has the global configuration
vm.network.throttling.ratethat allows limiting the maximum bandwidth of the default NIC for end-user VMs when it is not defined in compute offerings. However, currently, the setting is static, implying the requirement of restarting the Management Servers after changing its value.Given this scenario, changes have been applied to make the configuration dynamic. As a consequence, it is not required to restart the Management Servers after each value update; the updated value is automatically considered in the Apache CloudStack internal workflows.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):
How Has This Been Tested?
The default value of
vm.network.throttling.rateis 200, and after changing its value to 100 the VM's domain XML presented the following change:Before:
After: