Skip to content

Add access modifiers to VirtualMachineTO #9277

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

Merged
merged 5 commits into from
Jun 17, 2025

Conversation

FelipeM525
Copy link
Contributor

Description

The class VirtualMachineTO lacks access modifiers in its fields. This PR aims to improve adherence to object-oriented programming by adding private access modifiers to all fields in the class mentioned above, along with their respective getters and setters.

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

Feature/Enhancement Scale

  • Major
  • Minor

How Has This Been Tested?

I ran all the tests related to VirtualMachineTO, checked all usages of the class, and made sure nothing was broken.

Co-authored-by: Fabricio Duarte <fabricio.duarte.jr@gmail.com>
@JoaoJandre
Copy link
Contributor

@FelipeM525 there are some test failures

Copy link

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

@sureshanaparti sureshanaparti added this to the 4.21.0 milestone Jun 5, 2025
@sureshanaparti
Copy link
Contributor

@blueorangutan package

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves encapsulation in the VirtualMachineTO class by adding private access modifiers to previously package-private fields and introducing corresponding getters and setters.

  • Changed field visibility to private.
  • Added new accessor and mutator methods for improved object-oriented design.
  • Ensured backward compatibility with existing functionality.
Comments suppressed due to low confidence (2)

api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java:257

  • [nitpick] Consider renaming isEnableHA() to isHaEnabled() to better align with Java naming conventions for boolean getters.
public boolean isEnableHA() {

api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java:440

  • Consider adding JavaDoc comments to the newly added getters and setters to improve code clarity and maintainability.
public void setSpeed(Integer speed) {

@blueorangutan
Copy link

@sureshanaparti 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
Copy link

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

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@winterhazel , can you assess the status of this PR , please?

@winterhazel
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

@winterhazel
Copy link
Member

@winterhazel , can you assess the status of this PR , please?

@DaanHoogland I fixed the merge conflicts, it should be good to go if the CI passses. I don't think we need more testing for a simple change like this one.

Copy link

codecov bot commented Jun 16, 2025

Codecov Report

Attention: Patch coverage is 23.07692% with 30 lines in your changes missing coverage. Please review.

Project coverage is 16.60%. Comparing base (e83a347) to head (f3cb29c).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../java/com/cloud/agent/api/to/VirtualMachineTO.java 23.07% 30 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9277      +/-   ##
============================================
- Coverage     16.60%   16.60%   -0.01%     
- Complexity    13923    13924       +1     
============================================
  Files          5730     5730              
  Lines        508224   508254      +30     
  Branches      61789    61789              
============================================
- Hits          84383    84382       -1     
- Misses       414406   414436      +30     
- Partials       9435     9436       +1     
Flag Coverage Δ
uitests 3.93% <ø> (ø)
unittests 17.49% <23.07%> (-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.

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@DaanHoogland DaanHoogland merged commit f8c4121 into apache:main Jun 17, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants