-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix of deployment VM from a copied snapshot in another zone #11351
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
Fix of deployment VM from a copied snapshot in another zone #11351
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11351 +/- ##
============================================
- Coverage 17.35% 17.35% -0.01%
+ Complexity 15231 15229 -2
============================================
Files 5885 5885
Lines 525611 525617 +6
Branches 64160 64157 -3
============================================
- Hits 91224 91214 -10
- Misses 424090 424107 +17
+ Partials 10297 10296 -1
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 VM deployment issues when using snapshots from different zones, specifically addressing StorPool volume creation from snapshots when the offering size exceeds the snapshot size.
- Removed complex volume size determination logic in favor of standardized disk size configuration
- Eliminated override disk offering assignments for both volume and snapshot-based deployments
- Fixed StorPool template resizing to only apply to template objects, not all storage objects
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| UserVmManagerImpl.java | Simplified volume size calculation and removed disk offering overrides for cross-zone deployments |
| StorPoolDownloadTemplateCommandWrapper.java | Moved StorPool resize operation to only execute for template objects |
| volumesSize = configureCustomRootDiskSize(customParameters, template, hypervisorType, rootDiskOffering); | ||
| } | ||
| long volumesSize = configureCustomRootDiskSize(customParameters, template, hypervisorType, rootDiskOffering); | ||
|
|
Copilot
AI
Jul 30, 2025
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.
The simplified logic now ignores the actual size of existing volumes and snapshots, which could lead to data loss or corruption when the configured size is smaller than the source volume/snapshot size. Consider adding validation to ensure the configured size is at least as large as the source.
| // Validate that the configured size is at least as large as the source volume or snapshot size | |
| if (snapshot != null) { | |
| long sourceSize = snapshot.getSize(); // Assuming snapshot.getSize() returns the size in bytes | |
| if (volumesSize < sourceSize) { | |
| throw new InvalidParameterValueException("The configured root disk size (" + volumesSize + | |
| " bytes) is smaller than the source snapshot size (" + sourceSize + " bytes)."); | |
| } | |
| } else if (volume != null) { | |
| long sourceSize = volume.getSize(); // Assuming volume.getSize() returns the size in bytes | |
| if (volumesSize < sourceSize) { | |
| throw new InvalidParameterValueException("The configured root disk size (" + volumesSize + | |
| " bytes) is smaller than the source volume size (" + sourceSize + " bytes)."); | |
| } | |
| } |
| StorPoolStorageAdaptor.resize( Long.toString(srcDisk.getVirtualSize()), dst.getPath()); | ||
|
|
Copilot
AI
Jul 30, 2025
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.
The resize operation is now only called for TemplateObjectTO instances, but there's no validation that srcDisk.getVirtualSize() is appropriate for the destination. Consider adding size validation before calling resize.
| StorPoolStorageAdaptor.resize( Long.toString(srcDisk.getVirtualSize()), dst.getPath()); | |
| if (dst.getSize() != null && dst.getSize() < srcDisk.getVirtualSize()) { | |
| final String error = "Destination size " + dst.getSize() + " is smaller than source virtual size " + srcDisk.getVirtualSize(); | |
| SP_LOG(error); | |
| return new CopyCmdAnswer(error); | |
| } | |
| StorPoolStorageAdaptor.resize(Long.toString(srcDisk.getVirtualSize()), dst.getPath()); |
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.
very sensible comment @Copilot, but it has nothing to do with the changes at hand.
|
@blueorangutan package |
| StorPoolStorageAdaptor.resize( Long.toString(srcDisk.getVirtualSize()), dst.getPath()); | ||
|
|
||
| if (dst instanceof TemplateObjectTO) { | ||
| StorPoolStorageAdaptor.resize( Long.toString(srcDisk.getVirtualSize()), dst.getPath()); |
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.
| StorPoolStorageAdaptor.resize( Long.toString(srcDisk.getVirtualSize()), dst.getPath()); | |
| StorPoolStorageAdaptor.resize(Long.toString(srcDisk.getVirtualSize()), dst.getPath()); |
DaanHoogland
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.
clgtm, the second copilot remark seems as mute as the first one, I imaging that configureCustomRootDiskSize already does the checks sugested.
nvazquez
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 (haven't tested it though)
|
@blueorangutan package |
|
@nvazquez 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14479 |
|
@blueorangutan test |
|
@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-13981) |
|
@blueorangutan test |
|
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-13988)
|
fix of deploy VM with a snapshot that is copied to another zone fix of creating StorPool volume from a snapshot if the size in the offering is bigger than the snapshot size
2652739 to
2d2990d
Compare
|
@blueorangutan package |
|
@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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14566 |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-14038)
|
…1351) * Fix of deploy VM with a snapshot that is copied to another zone * Fix of creating StorPool volume from a snapshot if the size in the offering is bigger than the snapshot size
Description
This PR fixes the deployment of a VM with a snapshot that is copied to another zone.
Fix for creating StorPool volume from a snapshot if the size in the offering is bigger than the snapshot size
Types of changes
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Manually tested