Repository navigation
CSTACKEX-337: fixing the bug for First VM deployment double-counts template size - #125
sathvikaragi wants to merge 1 commit into
Conversation
…e template size when calculating the minimum primary storagepool size required by removing template size being added in allocatedpoolcapacity
🔴 Test Coverage Grade:
|
| Metric | Value |
|---|---|
| Line coverage | 24.85% |
| Branch coverage | 19.02% |
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
| } | ||
|
|
||
| return totalAllocatedSize; | ||
| return getUsedBytes(pool); |
There was a problem hiding this comment.
Adaptive breaks because it is managed storage and creates a real template copy on the array but its overriding method returns 0. So the template size will not get added for them
There was a problem hiding this comment.
Yes, There are vendors who return getBytesRequiredForTemplate 0 which is called in getAskingSizeForTemplateBasedOnClusterAndStoragePool. But From the cloudstack perspective They are expected to implement these methods to provide their template size. Template size shouldn't be part of allocated size calculation as keeping it here will lead to double counting of template size for all vendors who have implemented getBytesRequiredForTemplate in driver.
template size is counted twice when calculating the minimum primary storagepool size required
Description
storagePoolHasEnoughSpace accepts a pool when allocatedSizeWithTemplate + totalAskingSize fits. On the first VM deploy from a template onto a managed pool, the template size was added on both sides.
For a root volume, the method passes the template into getAllocatedPoolCapacity, which stored it in allocatedSizeWithTemplate. It then adds the volume size and getAskingSizeForTemplateBasedOnClusterAndStoragePool into totalAskingSize. That second call returns the template size again from getBytesRequiredForTemplate when the pool is managed and clusterId is set. The check asked for used bytes + volume size + 2 × template size.
Managed pools now return only getUsedBytes from getAllocatedPoolCapacity. The template is reserved once, in totalAskingSize. This extra add came from Dell's PowerFlex PR.Before that, a managed pool contributed only getUsedBytes to allocatedSizeWithTemplate.
This PR...
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
ISCSI VM creation , allocated size get's only used bytes of pool for first time VM creation




NFS VM creation , allocated size get's only used bytes of pool for first time VM creation
BOTH NFS AND ISCSI POOLS WERE MADE OF 18 GB and succeeded
How did you try to break this feature and the system with this change?