Skip to content

engine/schema: use PostConstruct in FirewallRulesDaoImpl#13397

Draft
weizhouapache wants to merge 2 commits into
apache:mainfrom
weizhouapache:4.22-improve-FirewallRulesDaoImpl
Draft

engine/schema: use PostConstruct in FirewallRulesDaoImpl#13397
weizhouapache wants to merge 2 commits into
apache:mainfrom
weizhouapache:4.22-improve-FirewallRulesDaoImpl

Conversation

@weizhouapache

Copy link
Copy Markdown
Member

Description

This PR moves the initialization of VmSearch to a method annotated with @PostConstruct in FirewallRulesDaoImpl.

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?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 refactors FirewallRulesDaoImpl initialization so that the VmSearch SearchBuilder is created during bean initialization (@PostConstruct) rather than lazily inside listStaticNatByVmId, aligning it with other DAO patterns that depend on injected collaborators.

Changes:

  • Added a @PostConstruct init() method to build VmSearch using the injected _ipDao.
  • Removed the VmSearch == null lazy-initialization block from listStaticNatByVmId.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.75%. Comparing base (a7f9756) to head (1527c1d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...va/com/cloud/network/dao/FirewallRulesDaoImpl.java 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13397   +/-   ##
=========================================
  Coverage     18.75%   18.75%           
- Complexity    17964    17967    +3     
=========================================
  Files          6160     6160           
  Lines        552571   552572    +1     
  Branches      67346    67346           
=========================================
+ Hits         103651   103660    +9     
+ Misses       437514   437506    -8     
  Partials      11406    11406           
Flag Coverage Δ
uitests 3.53% <ø> (ø)
unittests 19.95% <0.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread engine/schema/src/main/java/com/cloud/network/dao/FirewallRulesDaoImpl.java Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@weizhouapache weizhouapache added this to the 4.22.2 milestone Jun 11, 2026
@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines +127 to +129
SearchBuilder<IPAddressVO> IpSearch = _ipDao.createSearchBuilder();
IpSearch.and("associatedWithVmId", IpSearch.entity().getAssociatedWithVmId(), SearchCriteria.Op.EQ);
IpSearch.and("oneToOneNat", IpSearch.entity().isOneToOneNat(), SearchCriteria.Op.NNULL);
@blueorangutan

Copy link
Copy Markdown

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

@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-16291)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 48791 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr13397-t16291-kvm-ol8.zip
Smoke tests completed. 151 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

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.

3 participants