Skip to content

Fix list StorPool primary storage#13119

Open
slavkap wants to merge 1 commit intoapache:mainfrom
storpool:fix-list-storpool-pool
Open

Fix list StorPool primary storage#13119
slavkap wants to merge 1 commit intoapache:mainfrom
storpool:fix-list-storpool-pool

Conversation

@slavkap
Copy link
Copy Markdown
Contributor

@slavkap slavkap commented May 7, 2026

Description

This PR fixes the StorPool primary storage listing in the listStoragePools API, addressing an issue introduced in PR #12502
StorPool was using as a prefix in the UUID the StorPool's template to which is attached the primary storage. Now we're getting this information from the storage details

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)

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Upgrade from CS 4.20.3.0 to main with StorPool primary storage

Fixes listing of StorPool primary storage when using listStoragePools API
@winterhazel
Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@winterhazel 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
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 0% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.09%. Comparing base (1e512ab) to head (9036846).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ava/com/cloud/upgrade/dao/Upgrade42210to42300.java 0.00% 38 Missing ⚠️
...orage/datastore/provider/StorPoolHostListener.java 0.00% 3 Missing ⚠️
...hypervisor/kvm/storage/StorPoolStorageAdaptor.java 0.00% 2 Missing ⚠️
...ud/hypervisor/kvm/storage/StorPoolStoragePool.java 0.00% 2 Missing ⚠️
.../api/storage/StorPoolModifyStoragePoolCommand.java 0.00% 1 Missing ⚠️
...e/wrapper/StorPoolModifyStorageCommandWrapper.java 0.00% 1 Missing ⚠️
...e/lifecycle/StorPoolPrimaryDataStoreLifeCycle.java 0.00% 1 Missing ⚠️
...loudstack/storage/datastore/util/StorPoolUtil.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               main   #13119    +/-   ##
==========================================
  Coverage     18.08%   18.09%            
- Complexity    16706    16719    +13     
==========================================
  Files          6037     6037            
  Lines        542437   542587   +150     
  Branches      66420    66435    +15     
==========================================
+ Hits          98088    98155    +67     
- Misses       433333   433413    +80     
- Partials      11016    11019     +3     
Flag Coverage Δ
uitests 3.52% <ø> (-0.01%) ⬇️
unittests 19.25% <0.00%> (+<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.

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17757

@sureshanaparti sureshanaparti requested a review from Copilot May 7, 2026 14:25
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Fixes StorPool primary storage listing in listStoragePools by removing the template-name prefix from storage_pool.uuid and passing the template name through pool details instead.

Changes:

  • Stop prefixing StorPool primary storage UUIDs with templateName; and generate plain UUIDs instead.
  • Pass StorPool template name via storage pool details down to the KVM agent path (instead of parsing it from the UUID).
  • Add an upgrade migration to normalize existing StorPool pool UUIDs that still have the legacy templateName;uuid format.

Reviewed changes

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

Show a summary per file
File Description
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java Stop writing template-prefixed UUIDs when updating pool metadata.
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/provider/StorPoolHostListener.java Include SP_TEMPLATE in details sent to agent modify-storage command.
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/StorPoolPrimaryDataStoreLifeCycle.java Initialize StorPool primary storage with plain UUID.
plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/storage/StorPoolStoragePool.java Read StorPool template name from details and store it on the pool object.
plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/storage/StorPoolStorageAdaptor.java Use the stored template name instead of parsing it from the UUID.
plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/StorPoolModifyStorageCommandWrapper.java Forward command “details” into storage pool creation path.
plugins/storage/volume/storpool/src/main/java/com/cloud/agent/api/storage/StorPoolModifyStoragePoolCommand.java Extend command ctor to accept details and pass them to base command.
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java Add data migration to normalize legacy StorPool UUIDs to plain UUIDs.

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

_sourcePort = port;
_storagePoolType = storagePoolType;
_storageAdaptor = storageAdaptor;
_authUsername = details.get(StorPoolUtil.SP_TEMPLATE);
srcFile = new QemuImgFile(srcTemplateFilePath, srcFileFormat);

String spTemplate = destPool.getUuid().split(";")[0];
String spTemplate = destPool.getAuthUserName();
Comment on lines +95 to +99
final String[] parts = templatePrefixedPoolUuid.split(";");
if (parts.length < 2) {
continue;
}
final String realUuid = parts[1].trim();
Comment on lines 63 to +66
public void performDataMigration(Connection conn) {
unhideJsInterpretationEnabled(conn);
normalizeStorPoolPrimaryStorageUuids();
}
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.

4 participants