Skip to content

Conversation

@sureshanaparti
Copy link
Contributor

@sureshanaparti sureshanaparti commented Aug 14, 2025

Description

This PR fixes create template from snapshot, for snapshots on primary storage and storage doesn't support create snapshot to template directly.

seems to be regression from #9478

Fixes #11451

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 create volume snapshot (for volumes of running instance) with NFS & PowerFlex primary pools and NFS secondary, and created template & volume from snapshot on NFS primary, created template from snapshot on PowerFlex primary.

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

@sureshanaparti sureshanaparti requested review from rp- and slavkap August 14, 2025 21:49
@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@sureshanaparti sureshanaparti added this to the 4.21.0 milestone Aug 14, 2025
@sureshanaparti sureshanaparti marked this pull request as ready for review August 14, 2025 21:51
@blueorangutan
Copy link

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@codecov
Copy link

codecov bot commented Aug 14, 2025

Codecov Report

❌ Patch coverage is 3.70370% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.36%. Comparing base (9fd2b90) to head (1aef01f).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...n/java/com/cloud/template/TemplateManagerImpl.java 0.00% 12 Missing ⚠️
...stack/engine/orchestration/VolumeOrchestrator.java 0.00% 9 Missing ⚠️
...org/apache/cloudstack/snapshot/SnapshotHelper.java 16.66% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #11452   +/-   ##
=========================================
  Coverage     17.36%   17.36%           
+ Complexity    15236    15235    -1     
=========================================
  Files          5886     5886           
  Lines        525645   525663   +18     
  Branches      64156    64158    +2     
=========================================
+ Hits          91257    91261    +4     
- Misses       424093   424107   +14     
  Partials      10295    10295           
Flag Coverage Δ
uitests 3.63% <ø> (ø)
unittests 18.40% <3.70%> (+<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.

@sureshanaparti sureshanaparti changed the title Fix for create template from snapshot (for snapshots on primary storage and storage doesn't support create snapshot to template directly) [LINSTOR] Fix for create template from snapshot (for snapshots on primary storage and storage doesn't support create snapshot to template directly) Aug 14, 2025
@blueorangutan
Copy link

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

@rp-
Copy link
Contributor

rp- commented Aug 15, 2025

Sorry no, still the same error.

@sureshanaparti sureshanaparti marked this pull request as draft August 15, 2025 07:32
@sureshanaparti
Copy link
Contributor Author

Sorry no, still the same error.

ok

@rp-
Copy link
Contributor

rp- commented Aug 15, 2025

I'm trying a commit before #9478 to see if it really is the cause of it.

@sureshanaparti
Copy link
Contributor Author

I'm trying a commit before #9478 to see if it really is the cause of it.

The if cond. added there matches for only StorPool. I'm assuming Linstor should take the else path, as snapshots will be in primary storage, not Image and earlier condition kvmSnapshotOnlyInPrimaryStorage is missing.

@rp-
Copy link
Contributor

rp- commented Aug 15, 2025

I'm trying a commit before #9478 to see if it really is the cause of it.

The if cond. added there matches for only StorPool. I'm assuming Linstor should take the else path, as snapshots will be in primary storage, not Image and earlier condition kvmSnapshotOnlyInPrimaryStorage is missing.

Volume snapshots per default go to secondary storage, we have an option to keep all snapshots on primary storage.
So it depends...

@rp-
Copy link
Contributor

rp- commented Aug 15, 2025

I can confirm that it worked before: #9478

@sureshanaparti sureshanaparti changed the title [LINSTOR] Fix for create template from snapshot (for snapshots on primary storage and storage doesn't support create snapshot to template directly) Fix for create template from snapshot (for snapshots on primary storage and storage doesn't support create snapshot to template directly) Aug 15, 2025
@slavkap
Copy link
Contributor

slavkap commented Aug 15, 2025

@rp-, Linstor is keeping only on primary or only on secondary storage? Does it have an option to keep the snapshot on both?

@rp-
Copy link
Contributor

rp- commented Aug 15, 2025

@rp-, Linstor is keeping only on primary or only on secondary storage? Does it have an option to keep the snapshot on both?

Yes, only on either primary or secondary. There is NO option for both.

@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

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

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm, I think storage providers must test this in addition to smoke tests

@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@sureshanaparti
Copy link
Contributor Author

Hi @slavkap @rp- Please verify template & volume creation from snapshot with this PR and confirm. Thanks.

@apache apache deleted a comment from blueorangutan Aug 15, 2025
@apache apache deleted a comment from blueorangutan Aug 15, 2025
@apache apache deleted a comment from DaanHoogland Aug 15, 2025
@blueorangutan
Copy link

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

Copy link
Contributor

@slavkap slavkap left a comment

Choose a reason for hiding this comment

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

code LGTM
created volume from a snapshot with NFS, Ceph and StorPool as primary storage
created template from a snapshot with NFS/Ceph and StorPool
with enabled/disabled snapshot.backup.to.secondary option

@DaanHoogland
Copy link
Contributor

@rp- ,can you test as well (and maybe others?)

Copy link
Contributor

@rp- rp- left a comment

Choose a reason for hiding this comment

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

tested create template and create volume from snapshot and works now

@sureshanaparti sureshanaparti marked this pull request as ready for review August 15, 2025 14:04
@sureshanaparti
Copy link
Contributor Author

thanks @slavkap @rp- for testing this.

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm

@nvazquez
Copy link
Contributor

@blueorangutan test

@sureshanaparti sureshanaparti merged commit f671461 into apache:main Aug 15, 2025
25 of 26 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Apache CloudStack 4.21.0 Aug 15, 2025
@sureshanaparti sureshanaparti deleted the 4.21-linstor-template-from-snapshot-issue branch August 15, 2025 16:47
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Sep 4, 2025
…ge and storage doesn't support create snapshot to template directly) (apache#11452)

* Fix for create template from snapshot

* code improvements, for create volume from snapshot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

LINSTOR create template from snapshot not working

7 participants