cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

linstor: Use template's uuid if pool's downloadPath is null as resour…

Open ghernadi opened this issue 6 months ago • 1 comments

Description

My colleague, @rp- is on vacation right now and we found a bug where the previously non-null VMTemplateStoragePoolVO#getLocalDownloadPath for some reason returns null in the recent versions of Cloudstack. This is my attempt to patch the issue, which worked in our test-setup.

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] 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
  • [x] Minor

Bug Severity

  • [ ] BLOCKER
  • [ ] Critical
  • [ ] Major
  • [x] Minor
  • [ ] Trivial

Screenshots (if appropriate):

How Has This Been Tested?

The following scenario no longer works without this patch:

  • Create a new VM (instance)
  • Stop VM and make a snapshot of it
  • Create a template from the just created snapshot
  • Create a new VM from the new template

The last step causes the cloud-plugin-storage-volume-linstor to try to clone from cs-null instead of cs-${template_uuid}. cs-null obviously does not exist within LINSTOR itself, which causes an error.

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

ghernadi avatar Jun 18 '25 12:06 ghernadi

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:

  • In case of a new feature add useful documentation (raise doc PR at https://github.com/apache/cloudstack-documentation)
  • Be patient and persistent. It might take some time to get a review or get the final approval from the committers.
  • Pay attention to the quality of your code, ensure tests are passing and your PR doesn't have conflicts.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Issues, Mailing list and Slack.
  • Be sure to read the CloudStack Coding Conventions. Apache CloudStack is a community-driven project and together we are making it better 🚀. In case of doubts contact the developers at: Mailing List: [email protected] (https://cloudstack.apache.org/mailing-lists.html) Slack: https://apachecloudstack.slack.com/

boring-cyborg[bot] avatar Jun 18 '25 12:06 boring-cyborg[bot]

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 16.57%. Comparing base (0d5a0ea) to head (2e1de6f). Report is 694 commits behind head on main.

Files with missing lines Patch % Lines
...tore/driver/LinstorPrimaryDataStoreDriverImpl.java 0.00% 6 Missing :warning:
.../hypervisor/kvm/storage/LinstorStorageAdaptor.java 0.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11053      +/-   ##
============================================
+ Coverage     15.18%   16.57%   +1.39%     
- Complexity    11365    13969    +2604     
============================================
  Files          5416     5743     +327     
  Lines        475890   510499   +34609     
  Branches      58093    62076    +3983     
============================================
+ Hits          72254    84623   +12369     
- Misses       395550   416413   +20863     
- Partials       8086     9463    +1377     
Flag Coverage Δ
uitests 3.90% <ø> (-0.39%) :arrow_down:
unittests 17.47% <0.00%> (+1.56%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jun 25 '25 07:06 codecov[bot]

My colleague, @rp- is on vacation right now and we found a bug where the previously non-null VMTemplateStoragePoolVO#getLocalDownloadPath for some reason returns null in the recent versions of Cloudstack. This is my attempt to patch the issue, which worked in our test-setup.

“recent” menaing unreleased versions, or also 4.19.3 and/or 4.20.1, @ghernadi ?

in the later case you may want to base your fix off of an older release branch.

DaanHoogland avatar Jun 25 '25 07:06 DaanHoogland

“recent” menaing unreleased versions, or also 4.19.3 and/or 4.20.1, @ghernadi ?

in the later case you may want to base your fix off of an older release branch.

To my understanding the old version (i.e. the version before my PR) was working as expected with versions 4.19.1.3 and 4.20.0.0, but 4.19.2.0 or 4.19.3.0 already require my PR to work again.

What branch do you suggest to rebase this PR?

ghernadi avatar Jun 27 '25 09:06 ghernadi

in that case 4.19 @ghernadi

DaanHoogland avatar Jun 27 '25 14:06 DaanHoogland

I'm back and will also update this PR and add the scenario to the integration tests

rp- avatar Jun 30 '25 12:06 rp-

@blueorangutan package

rp- avatar Jul 15 '25 03:07 rp-

@rp- 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 avatar Jul 15 '25 03:07 blueorangutan

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

blueorangutan avatar Jul 15 '25 04:07 blueorangutan

@rp- @ghernadi you guys want this on main only?

DaanHoogland avatar Jul 15 '25 10:07 DaanHoogland

@rp- @ghernadi you guys want this on main only?

This should be in 4.19, 4.20 and 4.21/main. As it is basically a regression bug fix.

rp- avatar Jul 15 '25 10:07 rp-

@rp- @ghernadi you guys want this on main only?

This should be in 4.19, 4.20 and 4.21/main. As it is basically a regression bug fix.

ok, can you rebase?

DaanHoogland avatar Jul 15 '25 11:07 DaanHoogland

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

github-actions[bot] avatar Jul 15 '25 11:07 github-actions[bot]

@rp- @ghernadi you guys want this on main only?

This should be in 4.19, 4.20 and 4.21/main. As it is basically a regression bug fix.

ok, can you rebase?

Oh sorry, I thought this was already on 4.19

rp- avatar Jul 15 '25 11:07 rp-

@blueorangutan package

DaanHoogland avatar Jul 15 '25 11:07 DaanHoogland

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

blueorangutan avatar Jul 15 '25 11:07 blueorangutan

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

blueorangutan avatar Jul 15 '25 12:07 blueorangutan

@blueorangutan package

rp- avatar Jul 25 '25 09:07 rp-

@rp- 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 avatar Jul 25 '25 09:07 blueorangutan

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

blueorangutan avatar Jul 25 '25 10:07 blueorangutan

Awesome work, congrats on your first merged pull request!

boring-cyborg[bot] avatar Jul 25 '25 11:07 boring-cyborg[bot]