-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix volume snapshot physical size after migration between secondary storages #12166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@blueorangutan package |
|
@hsato03 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 Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12166 +/- ##
============================================
- Coverage 17.56% 17.56% -0.01%
+ Complexity 15548 15547 -1
============================================
Files 5913 5913
Lines 529440 529440
Branches 64670 64670
============================================
- Hits 93019 93018 -1
- Misses 425963 425964 +1
Partials 10458 10458
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 fixes a bug where volume snapshot physical size was incorrectly set to 0 after migration between secondary storages using the migrateSecondaryStorageData and migrateResourceToAnotherSecondaryStorage APIs.
- Corrected the lookup of the destination snapshot store to use destination data store ID and snapshot ID instead of source parameters
- Aligned the snapshot handling pattern with the existing VolumeInfo and TemplateInfo handling in the same method
Comments suppressed due to low confidence (1)
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/SecondaryStorageServiceImpl.java:291
- The fixed bug in the
updateDataObjectmethod lacks test coverage. Consider adding a test case to verify that after migrating a snapshot between secondary storages, the physical size is correctly preserved. This would prevent similar regressions in the future.
private void updateDataObject(DataObject srcData, DataObject destData) {
if (destData instanceof SnapshotInfo) {
SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findBySourceSnapshot(srcData.getId(), DataStoreRole.Image);
SnapshotDataStoreVO destSnapshotStore = snapshotStoreDao.findByStoreSnapshot(DataStoreRole.Image, destData.getDataStore().getId(), destData.getId());
if (snapshotStore != null && destSnapshotStore != null) {
destSnapshotStore.setPhysicalSize(snapshotStore.getPhysicalSize());
destSnapshotStore.setCreated(snapshotStore.getCreated());
if (snapshotStore.getParentSnapshotId() != destSnapshotStore.getParentSnapshotId()) {
destSnapshotStore.setParentSnapshotId(snapshotStore.getParentSnapshotId());
}
snapshotStoreDao.update(destSnapshotStore.getId(), destSnapshotStore);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15860 |
bernardodemarco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm
Description
When migrating a volume snapshot from one secondary storage to another using the
migrateSecondaryStorageDataandmigrateResourceToAnotherSecondaryStorageAPIs, its physical size is set to0.This behavior was changed to preserve the physical size of the snapshot after migration.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
I migrated a volume snapshot using the
migrateSecondaryStorageDataandmigrateResourceToAnotherSecondaryStorageAPIs and verified that its physical size had not changed.How did you try to break this feature and the system with this change?