Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix issue when restoring backup after migration of volume#12549

Open
Pearl1594 wants to merge 5 commits into4.20 from
ghi12517-fix-restoreBkp-after-migration
Open

Fix issue when restoring backup after migration of volume #12549
Pearl1594 wants to merge 5 commits into4.20 from
ghi12517-fix-restoreBkp-after-migration

Conversation

@Pearl1594
Copy link
Contributor

@Pearl1594 Pearl1594 commented Jan 29, 2026

Description

This PR fixes: #12517

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

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

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

Copy link

codecov bot commented Jan 29, 2026
edited
Loading

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.37%. Comparing base (a6ccde4) to head (fe764c0).
⚠️ Report is 9 commits behind head on 4.20.

Files with missing lines Patch % Lines
...rg/apache/cloudstack/backup/NASBackupProvider.java 0.00% 11 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@
## 4.20 #12549 +/- ##
============================================
+ Coverage 16.26% 16.37% +0.10% 
- Complexity 13428 13622 +194 
============================================
 Files 5660 5661 +1 
 Lines 499907 502480 +2573 
 Branches 60696 61846 +1150 
============================================
+ Hits 81316 82267 +951 
- Misses 409521 411087 +1566 
- Partials 9070 9126 +56 
Flag Coverage Δ
uitests 5.04% <ø> (+0.89%) ⬆️
unittests 17.17% <0.00%> (+0.05%) ⬆️

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.

List<Backup.VolumeInfo> backedVolumes = backup.getBackedUpVolumes();
List<VolumeVO> volumes = backedVolumes.stream()
.map(volume -> volumeDao.findByUuid(volume.getUuid()))
.map(volume -> volumeDao.findByUuid(volume.getPath()))
Copy link
Contributor

@sureshanaparti sureshanaparti Jan 29, 2026

Choose a reason for hiding this comment

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

the new uuid or path after migration needs to be updated in the backed-up volumes metadata if any backups existing for them? any case path might also change?

Copy link
Contributor Author

@Pearl1594 Pearl1594 Jan 29, 2026
edited
Loading

Choose a reason for hiding this comment

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

The new UUID / path for the backed up volume doesn't need to be updated as the uuid - points to the volume UUID - which is always the same on subsequent backups, and the path points to the backup path - which shouldn't vary even if volume is migrated. I don't see the path of the backup changing.

Copy link
Contributor

@sureshanaparti sureshanaparti Jan 30, 2026

Choose a reason for hiding this comment

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

Suggested change
.map(volume -> volumeDao.findByUuid(volume.getPath()))
.map(backedVolumeInfo -> volumeDao.findByUuid(backedVolumeInfo.getPath()))

it's better change to backedVolumeInfo to avoid confusion.

@Pearl1594 Correct, path of the backup doesn't change. I mean, the volume path after migration might change as the volume is checked by its backed up path (which is before migration). cc @abh1sar

Copy link
Collaborator

@abh1sar abh1sar Feb 6, 2026
edited
Loading

Choose a reason for hiding this comment

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

I think we should not have path in the backed-up volumes metadata at all.

  1. Backup files are named suing the volume uuid
  2. The path in backed-up volumes is not being referenced anywhere apart from UI

volume.getPath() already gives us the path where we have to restore. I don't see a point in maintaining it in backup metadata also and updating it whenever volume path changes.

There was a PR merged on main that makes the UI reference uuid instead of path. (#12156)
So I propose removing path entirely from Backup.VolumeInfo in the main branch. We don't need upgrade handling also. The path in the DB for older backups will simply get ignored.

Now in the context of this PR, we should get the path from volume.getPath() not from backup-up volumes metadata.

Thoughts? @sureshanaparti @Pearl1594

Copy link
Contributor Author

@Pearl1594 Pearl1594 Feb 6, 2026
edited
Loading

Choose a reason for hiding this comment

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

With respect to this statement:

Now in the context of this PR, we should get the path from volume.getPath() not from backup-up volumes metadata.

I think we need to consider backedVolume.getPath() - as a volume could have gotten migrated and the path changes. But when restoring from a backup, we need to reference the path of the backedVolume (which was the path of the volume prior to the migrate operation). Correct me if I'm wrong.
If volumeUuid is passed, then volume's uuid is used, but, when null, it uses the backupVolume path to determine the backup file as seen in : https://github.com/apache/cloudstack/blob/main/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java#L224-L225

@Pearl1594 Pearl1594 added this to the 4.20.3 milestone Jan 29, 2026
Copy link
Contributor Author

@blueorangutan package

Copy link

@Pearl1594 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.

Copy link

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

Copy link
Contributor Author

Copy link

@Pearl1594 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

Copy link

[SF] Trillian test result (tid-15340)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 50996 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12549-t15340-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

Copy link
Contributor

@blueorangutan package

Copy link

@DaanHoogland 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.

Copy link

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

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

Copy link
Contributor Author

@blueorangutan package

Copy link
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm

Copy link
Contributor

@blueorangutan package

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.

Copy link

sonarqubecloud bot commented Feb 5, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

Copy link

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

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

Reviewers

@DaanHoogland DaanHoogland DaanHoogland approved these changes

@sureshanaparti sureshanaparti sureshanaparti approved these changes

+1 more reviewer

@abh1sar abh1sar abh1sar left review comments

Reviewers whose approvals may not affect merge requirements

Projects

None yet

Milestone

4.20.3

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /