BryanMLima opened a new pull request #6031:
URL: https://github.com/apache/cloudstack/pull/6031
### Description
This PR addresses an issue when live scaling a VM with the KVM hypervisor.
When the VM has the CPU cores or CPU speed increased, the cpu_shares (priority)
of the VM is not updated accordingly. To overcome that, it was needed to
manually restart the VM or using the command: `virsh schedinfo --domain
<vm_internal_name> --live cpu_shares=<cpu_shares_value>`. This PR changes this
to automatically update the cpu_shares when the CPU cores or speed is
increased. It is worth mention that the current behavior caused steal time when
VMs would compete for the CPU after a dynamic scale process.
Steps to reproduce:
- Host
- 6 vCPUs X 2.39Ghz
- 16GB RAM
- Custom service offering
- 1 to 6 vCPUs
- 2.35Ghz
- VM (deploy config)
- 1 vCPU
- 1024MB RAM
The cpu_shares of a VM is calculated as follow:
`cpu_shares = number of vCPUs X vCPU frequency in Mhz`
Using the command `virsh schedinfo --domain <internal_vm_name>` the
cpu_shares displayed was 2350, which is expected. However, when live scaling
the VM to 4 vCPUs, which should return 9400 shares, it was the initial 2350
shares. If the VM is restarted, however, the 9400 shares is used, as it should
without the need to restart the VM.
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] 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)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [x] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [x] Minor
- [ ] Trivial
### How Has This Been Tested?
Using the same configuration and steps I used to describe the bug. Then,
when live scaling a VM, it returns the correct cpu_shares without the need to
restart it. Therefore, when the VM with the 2350 shares is live scaled to 4
vCPUs, the cpu_shares when using the command mentioned above, returned the
correct value of 9400.
Moreover, I created unit tests for the affected methods.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]