Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Cleanup] Refactor importing VM method #11037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
nvazquez wants to merge 1 commit into apache:main
base: main
Choose a base branch
Loading
from shapeblue:421-refactor-importvm

Conversation

@nvazquez
Copy link
Contributor

@nvazquez nvazquez commented Jun 16, 2025

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?

Copy link

codecov bot commented Jun 16, 2025
edited
Loading

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

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?

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@shwstppr shwstppr Awaiting requested review from shwstppr

@DaanHoogland DaanHoogland Awaiting requested review from DaanHoogland

Assignees

No one assigned

Projects

None yet

Milestone

4.23.0

Development

Successfully merging this pull request may close these issues.

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

AltStyle によって変換されたページ (->オリジナル) /