Skip to content

Rewrite of email alert about VR health checks - #14403

Open
erikbocks wants to merge 2 commits into
apache:mainfrom
scclouds:rewrite-vr-alerts
Open

erikbocks wants to merge 2 commits into
apache:mainfrom
scclouds:rewrite-vr-alerts

Conversation

@erikbocks

Copy link
Copy Markdown
Collaborator

Description

When one or more VR health checks fail and alert notifications are configured in the environment, an email that does not include details about which tests failed is sent. The message has been rewritten to display which health checks have failed.

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

Screenshots (if appropriate):

Alert received image

How Has This Been Tested?

Build the packages and installed them. Then, I created a new Isolated network and deploy a VM on it. The VR was accessed by console and the openssh-server package was purged. After that, I requested for fresh checks. As it could not access the VR via SSH, all the tests failed and an email was sent informing about the failure to access the Instance (image attached to the Screenshots section)

Copilot AI balanced review requested due to automatic review settings October 14, 2026 16:53

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 8.33333% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.77%. Comparing base (2f34b0c) to head (575a871).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ork/router/VirtualNetworkApplianceManagerImpl.java 8.69% 21 Missing ⚠️
...ud/network/dao/RouterHealthCheckResultDaoImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14403      +/-   ##
============================================
- Coverage     20.77%   20.77%   -0.01%     
+ Complexity    20847    20842       -5     
============================================
  Files          6053     6053              
  Lines        548222   548232      +10     
  Branches      73236    73237       +1     
============================================
- Hits         113896   113885      -11     
- Misses       420984   421004      +20     
- Partials      13342    13343       +1     
Flag Coverage Δ
uitests 3.86% <ø> (ø)
unittests 22.20% <8.33%> (-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.

ArrayList<String> failedChecks = new ArrayList<>();
for (String failedCheckName : failingChecks) {
RouterHealthCheckResultVO routerHealthCheckResultVO = routerHealthCheckResultDao.getRouterHealthCheckResult(router.getId(), failedCheckName, null);
String failedCheckDetails = routerHealthCheckResultVO.getParsedCheckDetails();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what happens if there is no saved result for a failing check? looks like it crashes here and the router recreate and the other routers get skipped

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hello, @Damans227

I checked the behavior that you mentioned about no saved result for a failing check and could not find a flow where this happens.

In the code, the router checks are parsed and saved to the database in the getFailingChecks method, before this piece of code. Even in scenarios where the command is not received by the router, or the router's file system is not writable, there is a separate handling to tackle those. This means that, even if the router does not have any check yet, the new checks will be persisted before the failing check handling is done.

To validate this, I created a VR locally and filled its volume with a dummy file created by dd, for the disk_space_check.py test to fail. With no tests registered yet, I requested fresh checks and validated with the IDE's debugging tool that all the checks were persisted before the handling part.

Have you seen any specific scenario of this happening, so we can test this solution and validate its behavior?

@github-actions

Copy link
Copy Markdown

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

# Conflicts:
#	server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java

This branch has not been deployed

No deployments
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