Skip to content

Set snapCPG in online copy request to fix snapshot failures on cloned volumes#12955

Open
poddm wants to merge 1 commit intoapache:4.22from
poddm:mp/4.22_fix_snapcpg
Open

Set snapCPG in online copy request to fix snapshot failures on cloned volumes#12955
poddm wants to merge 1 commit intoapache:4.22from
poddm:mp/4.22_fix_snapcpg

Conversation

@poddm
Copy link
Copy Markdown

@poddm poddm commented Apr 2, 2026

Description

The snapCPG parameter was missing from the online copy request parameters (PrimeraVolumeCopyRequestParameters), so the newly cloned volume was created without a snap CPG assignment. This caused subsequent snapshot operations on that volume to fail because Primera didn't know which CPG to allocate snapshot space from.

Fix: Added parms.setSnapCPG(snapCpg) to the online copy configuration in the copy() method, alongside the existing destCPG, tpvv, and reduce parameters.

Note: The direct create() path already set snapCPG correctly via request.setSnapCPG(snapCpg) — the gap was only in the online copy flow.

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?

Tested using both HPE Primera and Alletra arrays. Verified that volumes created via online copy now have the correct snapCPG set and that snapshot operations succeed.

2026-04-02 16:01:44,866 DEBUG [o.a.c.s.d.a.p.PrimeraAdapter] (Work-Job-Executor-1:[ctx-846f217c, job-10462/job-10463, ctx-c0684397]) (logid:c8c0c67d) PrimeraAdapter: Starting volume copy operation - source volume: 'tpl-17-0-18-315', target volume: 'ROOT-882', requested new size: 21474836480 bytes (20480 MiB)
2026-04-02 16:01:44,868 DEBUG [o.a.c.s.d.a.p.PrimeraAdapter] (Work-Job-Executor-1:[ctx-846f217c, job-10462/job-10463, ctx-c0684397]) (logid:c8c0c67d) PrimeraAdapter: Generated external name 'vol-17-1-29-1139' for target volume
2026-04-02 16:01:44,885 DEBUG [o.a.c.s.d.a.p.PrimeraAdapter] (Work-Job-Executor-1:[ctx-846f217c, job-10462/job-10463, ctx-c0684397]) (logid:c8c0c67d) PrimeraAdapter: No size change required (both 21474836480 bytes) - using online copy method for faster cloning
2026-04-02 16:01:44,891 DEBUG [o.a.c.s.d.a.p.PrimeraAdapter] (Work-Job-Executor-1:[ctx-846f217c, job-10462/job-10463, ctx-c0684397]) (logid:c8c0c67d) PrimeraAdapter: Online copy mode - target volume 'ROOT-882' will be created automatically during clone operation
2026-04-02 16:01:44,891 DEBUG [o.a.c.s.d.a.p.PrimeraAdapter] (Work-Job-Executor-1:[ctx-846f217c, job-10462/job-10463, ctx-c0684397]) (logid:c8c0c67d) PrimeraAdapter: Configuring online copy - destination CPG: 'mycpg', snapCPG: 'mycpg', deduplication enabled, thin provisioning disabled
 

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

@boring-cyborg
Copy link
Copy Markdown

boring-cyborg bot commented Apr 2, 2026

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

@poddm poddm changed the title set snapcpg config on copy Set snapCPG in online copy request to fix snapshot failures on cloned volumes Apr 2, 2026
@DaanHoogland DaanHoogland added this to the 4.22.1 milestone Apr 8, 2026
@DaanHoogland DaanHoogland requested a review from Copilot April 8, 2026 09:55
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.

Adds the missing snapCPG assignment to Primera’s online copy request so cloned volumes have a snapshot CPG configured, preventing snapshot failures after cloning.

Changes:

  • Set snapCPG on PrimeraVolumeCopyRequestParameters in the online copy flow.

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

parms.setSnapCPG(snapCpg);
parms.setTpvv(false);
parms.setReduce(true);
logger.debug("PrimeraAdapter: Configuring online copy - destination CPG: '{}', deduplication enabled, thin provisioning disabled", cpg);
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The debug log message is now misleading/incomplete because the code configures snapCPG (and also reduce) but the log only prints destCPG and omits snapCPG. This makes troubleshooting harder and can contradict operator expectations (the PR description/test output includes snapCPG). Update the log format and arguments to include snapCpg (and optionally reduce) so the message reflects the actual online copy configuration.

Suggested change
logger.debug("PrimeraAdapter: Configuring online copy - destination CPG: '{}', deduplication enabled, thin provisioning disabled", cpg);
logger.debug("PrimeraAdapter: Configuring online copy - destination CPG: '{}', snapshot CPG: '{}', reduce enabled: {}, thin provisioning enabled: {}",
cpg, snapCpg, true, false);

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

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 17.60%. Comparing base (4708121) to head (052603d).
⚠️ Report is 2 commits behind head on 4.22.

Files with missing lines Patch % Lines
...rage/datastore/adapter/primera/PrimeraAdapter.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #12955      +/-   ##
============================================
- Coverage     17.60%   17.60%   -0.01%     
+ Complexity    15677    15676       -1     
============================================
  Files          5918     5918              
  Lines        531681   531682       +1     
  Branches      65005    65005              
============================================
- Hits          93623    93612      -11     
- Misses       427498   427510      +12     
  Partials      10560    10560              
Flag Coverage Δ
uitests 3.70% <ø> (ø)
unittests 18.67% <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.

@DaanHoogland
Copy link
Copy Markdown
Contributor

@rg9975, could you review?

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.

3 participants