Skip to content

Conversation

@nvazquez
Copy link
Contributor

Description

This PR refactors the long method for importing VMs.

Fixes #11033

Types of changes

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

Screenshots (if appropriate):

How Has This Been Tested?

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

@codecov
Copy link

codecov bot commented Jun 16, 2025

Codecov Report

❌ Patch coverage is 84.48276% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.60%. Comparing base (6aaaa83) to head (c434e06).
⚠️ Report is 121 commits behind head on main.

Files with missing lines Patch % Lines
.../apache/cloudstack/vm/UnmanagedVMsManagerImpl.java 84.48% 4 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #11037   +/-   ##
=========================================
  Coverage     16.60%   16.60%           
- Complexity    13925    13934    +9     
=========================================
  Files          5730     5730           
  Lines        508224   508252   +28     
  Branches      61789    61783    -6     
=========================================
+ Hits          84388    84417   +29     
+ Misses       414401   414399    -2     
- Partials       9435     9436    +1     
Flag Coverage Δ
uitests 3.93% <ø> (ø)
unittests 17.50% <84.48%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@DaanHoogland
Copy link
Contributor

@nvazquez , this looks like a good improvement. I wonder if a bigger win can be made (as well).

baseImportInstance calls two methods based on the cmd Object and both of those get a lot of parameters. In turn they both call importVirtualMachineInternal which gets 21 parameters. I imagine most of those come from the cmd object or are directly consequential to the contents of it. If we just keep passing the cmd object, if need be on the basis of an interface, I think we can make that part more legible and in the process more optimal on runtime. What do you think?

@github-actions
Copy link

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

@DaanHoogland DaanHoogland added this to the 4.23 milestone Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

the method importVirtualMachineInternal(..) now is 153 lines and takes 21 parameters.

2 participants