Skip to content

First VM deployment double-counts template size in storagepoolhasenoughspace - #14442

Open
sathvikaragi wants to merge 1 commit into
apache:mainfrom
NetApp:storagepoolhasenoughspace-counts-templatesize-twice
Open

sathvikaragi wants to merge 1 commit into
apache:mainfrom
NetApp:storagepoolhasenoughspace-counts-templatesize-twice

Conversation

@sathvikaragi

@sathvikaragi sathvikaragi commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

template size is counted twice when calculating the minimum primary storagepool size required for managed pools

image

Fixes : #14444

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.
    During Vm creation,storagepoolhasenoughspace is called which then calls the method getAllocatedPoolCapacity, which fetched the used bytes and template size 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. This leads to getting total required size as 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

  • 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?

ISCSI VM creation , allocated size get's only used bytes of pool for first time VM creation
Screenshot 2026-10-15 at 6 52 45 PM
NFS VM creation , allocated size get's only used bytes of pool for first time VM creation
Screenshot 2026-10-15 at 8 37 29 PM
Screenshot 2026-10-15 at 8 38 43 PM

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

…mplate size (#125)

template size is counted twice when calculating the minimum primary
storagepool size required
 
<img width="2196" height="902" alt="image"
src="https://github.com/user-attachments/assets/009bc45f-4375-41f7-ae1c-90edca683a87"
/>


### 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...
<!--- Describe your changes in DETAIL - And how has behaviour
functionally changed. -->

<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to
reproduce. -->

<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically
be closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->

<!---
*******************************************************************************
-->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE
DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!---
*******************************************************************************
-->

### 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)
- [ ] Build/CI
- [ ] Test (unit or integration test code)

### Feature/Enhancement Scale or Bug Severity

#### Feature/Enhancement Scale

- [ ] Major
- [X] Minor

#### Bug Severity

- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [X] Minor
- [ ] Trivial

### 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
<img width="1403" height="272" alt="Screenshot 2026-10-15 at 6 52 45 PM"
src="https://github.com/user-attachments/assets/3d862c7b-a8fe-472c-9857-29003284cb22"
/>
NFS VM creation , allocated size get's only used bytes of pool for first
time VM creation
<img width="1402" height="358" alt="Screenshot 2026-10-15 at 8 37 29 PM"
src="https://github.com/user-attachments/assets/88bdca34-3144-45f2-a081-4f864a48ed39"
/>
<img width="1453" height="271" alt="Screenshot 2026-10-15 at 8 38 43 PM"
src="https://github.com/user-attachments/assets/7b3635c5-d1df-4cf2-b38b-71dce915410e"
/>
BOTH NFS AND ISCSI POOLS WERE MADE OF 18 GB and succeeded
<img width="1517" height="118" alt="Screenshot 2026-10-15 at 8 38 52 PM"
src="https://github.com/user-attachments/assets/ba7607d6-c176-4216-88ab-3b934c5df549"
/>

<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran
to -->

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

<!-- see how your change affects other areas of the code, etc. -->

<!-- Please read the
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
document -->
@sathvikaragi
sathvikaragi marked this pull request as ready for review October 20, 2026 06:21
@sathvikaragi

Copy link
Copy Markdown
Contributor Author

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First VM deployment on a managed primary pool double-counts the template size in Storagepoolhasenoughspace

1 participant