cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Block volume shrink on Xen

Open JoaoJandre opened this issue 8 months ago • 16 comments

Description

On version 4.16.1.0 PR #5829 blocked volume shrinking via UI when using XenServer. However, this change was not sufficient, as the user may still use the APIs directly to try to shrink their volume. Furthermore, via UI, it is still possible to inform the shrink option when changing disk offerings. This PR removes that option from the UI; also, the resizeVolume and changeOfferingForVolume APIs were changed to block this type of operation when using XenServer, similar to what is done when using QCOW2.

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
  • [ ] Minor

Bug Severity

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

Screenshots (if appropriate):

How Has This Been Tested?

Here’s the English translation of your Markdown content:


Test Description

Via UI, I validated that the shrink option no longer appears for XenServer volumes:

  • Before: image

  • After: image

Via CMK, I validated that both APIs block the use of the parameter for XenServer:

(labinterno) 🐱 > change offeringforvolume id=53abae9c-ec2f-4ce3-964d-11981348d2e6 diskofferingid=9aac832e-cdc0-429a-87b5-7b6209111a5d size=10 shrinkok=true
{
  "jobid": "a674a9ae-4ec9-45eb-b2fb-6ee438c60645"
}
(labinterno) 🐱 > query asyncjobresult jobid=a674a9ae-4ec9-45eb-b2fb-6ee438c60645
...
  "errorcode": 431,
  "errortext": "Shrink volume is not supported for the XenServer hypervisor."
...
(labinterno) 🐱 > resize volume id=53abae9c-ec2f-4ce3-964d-11981348d2e6 size=28 shrinkok=true
{
  "jobid": "954da1c8-e107-41d4-a64c-5e15bfeec676"
}
(labinterno) 🐱 > query asyncjobresult jobid=954da1c8-e107-41d4-a64c-5e15bfeec676
...
  "errorcode": 432,
  "errortext": "Shrink volume is not supported for the XenServer hypervisor."
...

I also verified that the APIs still work correctly without using shrink:

(labinterno) 🐱 > change offeringforvolume id=53abae9c-ec2f-4ce3-964d-11981348d2e6 diskofferingid=9aac832e-cdc0-429a-87b5-7b6209111a5d size=100 shrinkok=true
{
  "jobid": "59934dc9-a6e8-42cc-802f-43004d705e2f"
}
(labinterno) 🐱 > query asyncjobresult jobid=59934dc9-a6e8-42cc-802f-43004d705e2f
...
  "jobresultcode": 0,
  "jobstatus": 1,
...
(labinterno) 🐱 > resize volume id=53abae9c-ec2f-4ce3-964d-11981348d2e6 size=30
{
  "jobid": "5848d956-75b3-43bb-acbc-5c3caf3cc9c4"
}
(labinterno) 🐱 > query asyncjobresult jobid=5848d956-75b3-43bb-acbc-5c3caf3cc9c4
...
  "jobresultcode": 0,
  "jobstatus": 1,
...

JoaoJandre avatar Jun 11 '25 12:06 JoaoJandre

Codecov Report

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

Project coverage is 16.14%. Comparing base (41de0b9) to head (c7e4af3). Report is 4 commits behind head on 4.20.

Files with missing lines Patch % Lines
...pper/xenbase/CitrixResizeVolumeCommandWrapper.java 0.00% 3 Missing and 2 partials :warning:
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 0.00% 2 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #11004      +/-   ##
============================================
- Coverage     16.14%   16.14%   -0.01%     
  Complexity    13255    13255              
============================================
  Files          5657     5657              
  Lines        497903   497908       +5     
  Branches      60375    60377       +2     
============================================
- Hits          80395    80389       -6     
- Misses       408549   408558       +9     
- Partials       8959     8961       +2     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 16.99% <0.00%> (-0.01%) :arrow_down:

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 11 '25 12:06 codecov[bot]

@blueorangutan package

JoaoJandre avatar Jun 11 '25 16:06 JoaoJandre

@JoaoJandre 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 Jun 11 '25 16:06 blueorangutan

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

blueorangutan avatar Jun 11 '25 17:06 blueorangutan

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

blueorangutan avatar Jun 12 '25 08:06 blueorangutan

@blueorangutan test

DaanHoogland avatar Jun 13 '25 18:06 DaanHoogland

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

blueorangutan avatar Jun 13 '25 18:06 blueorangutan

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

Test Result Time (s) Test File
test_10_reboot_cpvm_forced Error 9.46 test_ssvm.py

blueorangutan avatar Jun 14 '25 10:06 blueorangutan

@blueorangutan test ol8 xcpng82

DaanHoogland avatar Jun 14 '25 19:06 DaanHoogland

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

blueorangutan avatar Jun 14 '25 19:06 blueorangutan

[SF] Trillian Build Failed (tid-13526)

blueorangutan avatar Jun 14 '25 19:06 blueorangutan

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

Test Result Time (s) Test File
test_05_ping_in_cpvm_success Failure 15.45 test_diagnostics.py

blueorangutan avatar Jun 17 '25 05:06 blueorangutan

looks good, not sure if it needs further testing. let’s run tests again to satisfy my insanity: @blueorangutan test ol8 xcpng82

DaanHoogland avatar Jun 17 '25 10:06 DaanHoogland

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

blueorangutan avatar Jun 17 '25 10:06 blueorangutan

[SF] Trillian Build Failed (tid-13542)

blueorangutan avatar Jun 17 '25 10:06 blueorangutan

[SF] Trillian test result (tid-13547) Environment: xcpng82 (x2), Advanced Networking with Mgmt server ol8 Total time taken: 80961 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11004-t13547-xcpng82.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

blueorangutan avatar Jun 18 '25 10:06 blueorangutan

let’s run tests again to satisfy my insanity

I think it was satisfied :smiley:

Merging based on approvals and test results: https://github.com/apache/cloudstack/pull/11004#issuecomment-2983580775

GutoVeronezi avatar Jun 24 '25 12:06 GutoVeronezi