cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

[VMware] Consider CD/DVD drive when calculating next free unit number for volume attachment over IDE controller

Open winterhazel opened this issue 1 year ago • 7 comments

Description

When attaching a volume to an instance, CloudStack calculates the next free unit number of the disk controller that should be associated with the volume. However, for IDE disk controllers, CD/DVD drives associated with the controller are not taken into consideration when calculating the next available unit number. Due to this, an error happens in some situations when trying to attach a volume to an instance over IDE controllers because CloudStack tries to associate the volume to an unit number that is already being used.

The generic method of reproducing this problem is:

  1. Deploy a VM
  2. Set dataDiskController to ide
  3. If there are any volumes using IDE controllers, detach them
  4. Try to attach a volume

This PR fixes the issue by making the code also consider CD/DVD drives. Tests will be added in another PR alongside an extension for the disk controllers that I'm currently working on, as it will require me to modify this code again.

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)

Feature/Enhancement Scale or Bug Severity

Bug Severity

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

How Has This Been Tested?

  1. I deployed a VM from a template with both rootDiskController and dataDiskController set to ide, with only a root disk
  2. I detached the root disk
  3. I reattached the root disk. Before, an exception would be thrown in this step. After the changes, I verified that the volume was associated successfully to IDE(0:1)
  4. I attached a data disk. I verified that the volume was associated successfully to IDE(1:0)
  5. I attached another data disk. I verified that the volume was associated successfully to IDE(1:1)
  6. I tried to attach another data disk. I verified that an exception was thrown because the maximum number of devices over IDE controllers was reached

winterhazel avatar Sep 05 '24 19:09 winterhazel

@blueorangutan package

winterhazel avatar Sep 05 '24 19:09 winterhazel

@winterhazel 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 Sep 05 '24 19:09 blueorangutan

Codecov Report

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

Project coverage is 15.08%. Comparing base (0204cb7) to head (dddfea4). Report is 116 commits behind head on 4.19.

Files with missing lines Patch % Lines
...m/cloud/hypervisor/vmware/mo/VirtualMachineMO.java 0.00% 4 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##               4.19    #9644     +/-   ##
===========================================
  Coverage     15.08%   15.08%             
- Complexity    11185    11193      +8     
===========================================
  Files          5406     5406             
  Lines        473123   473215     +92     
  Branches      58163    60800   +2637     
===========================================
+ Hits          71371    71390     +19     
- Misses       393810   393877     +67     
- Partials       7942     7948      +6     
Flag Coverage Δ
uitests 4.30% <ø> (-0.01%) :arrow_down:
unittests 15.80% <0.00%> (+<0.01%) :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.

codecov[bot] avatar Sep 05 '24 19:09 codecov[bot]

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

blueorangutan avatar Sep 05 '24 20:09 blueorangutan

@blueorangutan test ol8 vmware-70u3

rohityadavcloud avatar Sep 06 '24 03:09 rohityadavcloud

@rohityadavcloud a [SL] Trillian-Jenkins test job (ol8 mgmt + vmware-70u3) has been kicked to run smoke tests

blueorangutan avatar Sep 06 '24 03:09 blueorangutan

[SF] Trillian test result (tid-11398) Environment: vmware-70u3 (x2), Advanced Networking with Mgmt server ol8 Total time taken: 52194 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9644-t11398-vmware-70u3.zip Smoke tests completed. 131 look OK, 2 have errors, 0 did not run Only failed and skipped tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestPrivateGwACL>:setup Error 0.00 test_privategw_acl.py
test_09_project_suspend Error 1.11 test_projects.py
test_10_project_activation Error 1.09 test_projects.py

blueorangutan avatar Sep 06 '24 20:09 blueorangutan