[Cleanup] Refactor importing VM method
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)
- [x] 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 Report
:x: Patch coverage is 84.48276% with 9 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 16.60%. Comparing base (6aaaa83) to head (c434e06).
:warning: Report is 446 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| .../apache/cloudstack/vm/UnmanagedVMsManagerImpl.java | 84.48% | 4 Missing and 5 partials :warning: |
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%) |
: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.
@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?
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.