Skip to content

Allow cleaning up of networks stuck in Implementing state#12409

Open
Pearl1594 wants to merge 2 commits into4.20from
ghi12249-cleanupImplementingNetworks
Open

Allow cleaning up of networks stuck in Implementing state#12409
Pearl1594 wants to merge 2 commits into4.20from
ghi12249-cleanupImplementingNetworks

Conversation

@Pearl1594
Copy link
Contributor

Description

This PR fixes: #12249
This PR allows cleanup of Networks that have been stuck in Implementing state for more than the job.expire.minutes setting and has no async jobs associated.

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?

  1. Created a network
  2. Created a VM in that network and cleaned up the VM
  3. Set network (manually in DB) to Implementing state
  4. Observe logs (temporarily placed one of the trace logs in the code as debug)
...
Found 1 networks in Implementing state, checking for orphaned networks
2026-01-12 16:43:58,432 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (AsyncJobMgr-Heartbeat-1:[ctx-abe618b0]) (logid:5ee73b3f) Network 204 in Implementing state is only 9 minutes old (threshold: 10 minutes), skipping cleanup
..
 Found 1 networks in Implementing state, checking for orphaned networks
2026-01-12 16:44:08,434 WARN  [o.a.c.f.j.i.AsyncJobManagerImpl] (AsyncJobMgr-Heartbeat-1:[ctx-5012868f]) (logid:8c11718f) Found orphaned network 204 in Implementing state without async job. Network created: 2026-01-12T16:34:05.000+0000, age: 10 minutes, expiration threshold: 10 minutes. Transitioning to Shutdown state.

...
<img width="1621" height="147" alt="image" src="https://github.com/user-attachments/assets/8aadf16e-c022-4502-b88f-7c090a18e5f3" />

Moves network to Shutdown state and from there the networks can be deleted.

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

@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

❌ Patch coverage is 0% with 57 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.65%. Comparing base (4348386) to head (d6fe913).
⚠️ Report is 99 commits behind head on 4.20.

Files with missing lines Patch % Lines
...stack/framework/jobs/impl/AsyncJobManagerImpl.java 0.00% 57 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #12409      +/-   ##
============================================
+ Coverage     16.21%   16.65%   +0.43%     
- Complexity    13353    14136     +783     
============================================
  Files          5657     5660       +3     
  Lines        498647   520073   +21426     
  Branches      60533    69103    +8570     
============================================
+ Hits          80863    86603    +5740     
- Misses       408771   424021   +15250     
- Partials       9013     9449     +436     
Flag Coverage Δ
uitests 5.00% <ø> (+0.99%) ⬆️
unittests 17.47% <0.00%> (+0.40%) ⬆️

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

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

one nitpit, I would disect cleanupOrphanedNetworks() further as well.

@Pearl1594 Pearl1594 added this to the 4.20.3 milestone Jan 28, 2026
@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@Pearl1594 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 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16600

@nvazquez nvazquez self-assigned this Jan 29, 2026
@nvazquez nvazquez marked this pull request as ready for review January 29, 2026 11:43
@nvazquez
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@nvazquez 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-15335)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 51086 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12409-t15335-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
Collaborator

@sudo87 sudo87 left a comment

Choose a reason for hiding this comment

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

clgtm

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

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

sc.addAnd("removed", SearchCriteria.Op.NULL);
List<NetworkVO> implementingNetworks = networkDao.search(sc, null);

if (implementingNetworks == null || implementingNetworks.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (implementingNetworks == null || implementingNetworks.isEmpty()) {
if (CollectionUtils.isEmpty(implementingNetworks)) {

List<AsyncJobVO> jobs = _jobDao.findInstancePendingAsyncJobs("Network", network.getAccountId());
boolean hasActiveJob = false;
for (AsyncJobVO job : jobs) {
if (job.getInstanceId() != null && job.getInstanceId().equals(network.getId())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can pass these checks to jobDao and find the active job?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to delete or cleanup a network whose state is struck in Implementing

6 participants