Skip to content

Conversation

@shrikantjoshi-hpe
Copy link
Contributor

Description

This PR introduces a new HPE Storage Pool Allocator implementation with an enhanced maxfree volume allocation algorithm for improved storage resource management in Apache CloudStack.

Key Features

  1. New HPE Storage Pool Allocator
  • Implements HPEStoragePoolAllocator.java extending AbstractStoragePoolAllocator
  • Provides HPE-specific storage allocation logic and optimizations
  • Maintains full compatibility with existing storage allocation workflows
  1. Enhanced Volume Allocation Algorithm - "maxfree"
  • Introduces maxfree algorithm for intelligent storage pool selection
  • Implements storage pool ordering with reorderPoolsByFreeSpace() method
  • Reorders storage pools based on available free space in descending order
  • Pools with the most available free space will be prioritized first
  • Optimizes storage utilization by preventing storage pool exhaustion
  • Improves resource distribution across storage infrastructure

Algorithm Behavior

  • Input: List of eligible storage pools
  • Processing: Sorts pools by available free capacity in descending order
  • Output: Reordered list with highest free space pools first
  • Benefit: Prevents premature storage pool exhaustion and maintains balanced utilization

Files Modified

  • AbstractStoragePoolAllocator.java: Added reorderPoolsByFreeSpace() method for free space-based reordering
  • HPEStoragePoolAllocator.java: New HPE Storage-specific allocator implementation
  • spring-engine-storage-storage-allocator-context.xml: Register HPE Storage allocator bean
  • spring-core-registry-core-context.xml: Core registry configuration updates
  • VolumeOrchestrationService.java: Algorithm configuration support

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?

Unit Testing

  • Verified reorderPoolsByFreeSpace() method correctly sorts pools by available free space (descending)
  • Tested algorithm selection logic with maxfree parameter
  • Validated capacity calculation accuracy for both local and shared storage pools
  • Confirmed Spring configuration loading and bean registration

Integration Testing

  • Maxfree Algorithm Testing: Verified pools are consistently ordered by free space (highest first)
  • Backward Compatibility: Existing random and userdispersing algorithms work unchanged
  • Mixed Storage Types: Tested with combinations of local and shared storage pools
  • Capacity Edge Cases: Verified behavior with pools at various capacity levels (10%, 50%, 90%+ full)

System Testing

  • Free Space Validation: Confirmed volumes consistently allocated to pools with highest free space
  • Capacity Distribution: Verified balanced storage utilization across multiple pools
  • Hypervisor Compatibility: Tested across KVM environments

Breaking Testing Attempts

  • Capacity Gradient: Tested with pools having 95%, 70%, 45%, 20% free space - verified highest free space pools selected first
  • Dynamic Capacity Changes: Modified pool capacities during allocation - algorithm adapted correctly
  • Equal Capacity Pools: Multiple pools with identical free space - stable ordering maintained
  • Single Pool Scenarios: Algorithm works correctly with single pool environments

@sureshanaparti
Copy link
Contributor

@blueorangutan package

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new HPE Storage Pool Allocator with enhanced storage pool selection capabilities and implements a new "maxfree" volume allocation algorithm that prioritizes storage pools based on available free space.

  • Adds HPEStoragePoolAllocator for HPE Primera storage systems with Primera provider name filtering
  • Implements maxfree algorithm in AbstractStoragePoolAllocator that reorders pools by free space (descending)
  • Registers HPE allocator in Spring configuration with priority placement before existing allocators

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
HPEStoragePoolAllocator.java New allocator filtering pools by "Primera" storage provider name
AbstractStoragePoolAllocator.java Added reorderPoolsByFreeSpace() method and maxfree algorithm case
spring-engine-storage-storage-allocator-context.xml Registered HPEStoragePoolAllocator bean
spring-core-registry-core-context.xml Added HPEStorage to allocator order configuration
VolumeOrchestrationService.java Updated configuration documentation to include maxfree option

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* HPE Storage Pool Allocator
*
* This allocator is specifically designed for HPE storage systems and filters
* storage pools based on the storage provider name being "Primera". It extends the
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

Documentation mentions 'Primera' but the implementation filters by exact match. Consider documenting that this allocator is hardcoded to 'Primera' provider name only, and clarify whether this is intended to be HPE-specific or Primera-specific.

Copilot uses AI. Check for mistakes.
}

// Filter by Primera storage provider name (exact case match)
if ("Primera".equals(pool.getStorageProviderName())) {
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

The storage provider name 'Primera' is hardcoded as a magic string. Consider extracting this to a private static final constant (e.g., private static final String HPE_STORAGE_PROVIDER_NAME = \"Primera\";) to improve maintainability and make the provider name configurable in the future.

Copilot uses AI. Check for mistakes.

/**
* Reorders storage pools based on the configured volume allocation algorithm.
* Different algorithms provide different strategies for pool selection and ordering.
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

The added method-level documentation doesn't describe the method's parameters, return value, or the specific algorithms supported. Consider expanding this to match the detail level of other method documentation in this file, including @param, @return tags, and a list of supported algorithms.

Suggested change
* Different algorithms provide different strategies for pool selection and ordering.
* <p>
* Supported algorithms:
* <ul>
* <li><b>random</b>: Randomly shuffles the list of pools.</li>
* <li><b>userconcentratedpod_random</b>: Randomly shuffles the list of pools, concentrating on user pods.</li>
* <li><b>userdispersing</b>: Orders pools to disperse user volumes across different pools, reducing concentration.</li>
* <li><b>firstfitleastconsumed</b>: Orders pools by least consumed capacity, prioritizing those with more available space.</li>
* <li><b>maxfree</b>: Orders pools by maximum available free space (descending).</li>
* </ul>
* If the account is null, or the algorithm is "random" or "userconcentratedpod_random", pools are shuffled randomly.
*
* @param pools The list of storage pools to reorder.
* @param plan The deployment plan, used for context such as data center or pod.
* @param account The account for which the pools are being allocated; may affect algorithm selection.
* @return The reordered list of storage pools according to the selected algorithm.

Copilot uses AI. Check for mistakes.
<property name="orderConfigKey" value="storage.pool.allocators.order" />
<property name="orderConfigDefault"
value="LocalStorage,ClusterScopeStoragePoolAllocator,ZoneWideStoragePoolAllocator" />
value="HPEStorage,LocalStorage,ClusterScopeStoragePoolAllocator,ZoneWideStoragePoolAllocator" />
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

Placing HPEStorage first in the allocator order means it will be attempted before LocalStorage for all allocation requests. This could impact existing deployments when they upgrade, as HPE allocator will now be evaluated first even for non-HPE storage. Consider documenting this ordering decision or making it configurable per deployment to avoid unexpected behavior changes.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 1.36986% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.56%. Comparing base (2dbc86a) to head (2460238).

Files with missing lines Patch % Lines
...ack/storage/allocator/HPEStoragePoolAllocator.java 0.00% 57 Missing ⚠️
...torage/allocator/AbstractStoragePoolAllocator.java 6.25% 15 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11919      +/-   ##
============================================
- Coverage     17.56%   17.56%   -0.01%     
+ Complexity    15542    15541       -1     
============================================
  Files          5909     5910       +1     
  Lines        529058   529130      +72     
  Branches      64617    64629      +12     
============================================
  Hits          92922    92922              
- Misses       425683   425755      +72     
  Partials      10453    10453              
Flag Coverage Δ
uitests 3.58% <ø> (ø)
unittests 18.62% <1.36%> (-0.01%) ⬇️

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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants