alert messages restructure - #13775
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #13775 +/- ##
=============================================
- Coverage 19.65% 3.41% -16.24%
=============================================
Files 6368 487 -5881
Lines 574881 41867 -533014
Branches 70351 7912 -62439
=============================================
- Hits 112970 1429 -111541
+ Misses 449639 40238 -409401
+ Partials 12272 200 -12072
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Restructures several alert/log messages to be more consistent and information-rich, and introduces a shared formatter for host location descriptions (fixing CLOUDSTACK-7297).
Changes:
- Added
AlertFormatUtils.describeHostLocation(...)and reused it in HA/agent/orchestration alert call sites. - Updated many alerts/logs to include object context (e.g.,
host,domain,account) rather than only IDs/UUIDs. - Tweaked multiple failure/permission messages to improve operator readability.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/main/java/org/apache/cloudstack/outofbandmanagement/OutOfBandManagementServiceImpl.java | Updates host degraded/removed debug message formatting. |
| server/src/main/java/org/apache/cloudstack/ha/provider/host/HAAbstractHostProvider.java | Simplifies HA fencing/recovery alert subject/body to include host object. |
| server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java | Improves SSH provisioning error context by logging the host object. |
| server/src/main/java/com/cloud/vm/UserVmManagerImpl.java | Reworks several VM/host dedication alert messages; adds account/domain lookups for richer output. |
| server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java | Updates snapshot limit alert to reference account object. |
| server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java | Updates permission-denied exception messages to include domain object. |
| server/src/main/java/com/cloud/ha/KVMFencer.java | Updates fencing failure alerts to include host object. |
| server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java | Uses AlertFormatUtils for host location in HA alerts; improves VM-stopped alert host description. |
| server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java | Makes several validation exceptions include full entity objects (domain/network offering). |
| server/src/main/java/com/cloud/alert/AlertManagerImpl.java | Changes alert logging to structured logging with entity objects. |
| plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/provider/ScaleIOHostListener.java | Updates ScaleIO host/pool alerts/logs to include host object. |
| plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java | Updates ScaleIO disconnection checks/alerts to include host/pool objects. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/listener/OntapHostListener.java | Improves Ontap attach-storage error messages by using host object. |
| plugins/storage/volume/datera/src/main/java/org/apache/cloudstack/storage/datastore/provider/DateraHostListener.java | Improves Datera attach-storage alert message by using fetched host object. |
| engine/storage/volume/src/main/java/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java | Improves default host connect failure message by including host object. |
| engine/storage/src/main/java/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java | Updates upload/register/copy failure alerts to include object string. |
| engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/ScaleIOVMSnapshotStrategy.java | Clarifies VM snapshot failure message to include snapshot object context. |
| engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java | Uses AlertFormatUtils to include host location in agent network-setup failure alert. |
| engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java | Uses AlertFormatUtils for consistent host location strings in disconnect/alert-state messages. |
| engine/components-api/src/main/java/com/cloud/alert/AlertFormatUtils.java | New shared helper for consistent host/zone/pod alert formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| String subject = String.format("Failed to deploy Instance [%s]", vm); | ||
| String body = String.format("Failed to deploy [%s]%s. To troubleshoot, please check the logs with [logid:%s].", | ||
| vm, | ||
| hostId != null ? String.format(" on host [%s]", hostId) : "", | ||
| hostId != null ? String.format(" on host [%s]", host) : "", | ||
| ThreadContext.get("logcontextid")); |
| Long srcAccountId = accountOfDedicatedHost(srcHost); | ||
| Long destAccountId = accountOfDedicatedHost(destHost); | ||
| if (!((srcAccountId == null) || (srcAccountId.equals(destAccountId)))) { | ||
| Account srcAccount = _accountDao.findById(srcAccountId); | ||
| Account destAccount = _accountDao.findById(destAccountId); | ||
| String msg = String.format("VM is being migrated from host %s explicitly dedicated to account %s to host %s explicitly dedicated to account %s", | ||
| srcHost, srcAccount, destHost, destAccount); |
| if (Domain.ROOT_DOMAIN == domainId) { | ||
| // no one can add limits on ROOT domain, disallow... | ||
| throw new PermissionDeniedException("Cannot update resource limit for ROOT domain " + domainId + ", permission denied"); | ||
| throw new PermissionDeniedException("Cannot update resource limit for ROOT domain " + domain + ", permission denied"); |
| if ((caller.getDomainId() == domainId) && caller.getType() == Account.Type.DOMAIN_ADMIN || caller.getType() == Account.Type.RESOURCE_DOMAIN_ADMIN) { | ||
| // if the admin is trying to update their own domain, disallow... | ||
| throw new PermissionDeniedException("Unable to update resource limit for domain " + domainId + ", permission denied"); | ||
| throw new PermissionDeniedException("Unable to update resource limit for domain " + domain + ", permission denied"); |
| Long podId = pod == null ? null : pod.getId(); | ||
| long dcId = dataCenter == null ? 0L : dataCenter.getId(); | ||
| logger.warn(String.format("alertType=[%s] dataCenterId=[%s] podId=[%s] clusterId=[%s] message=[%s].", alertType, dcId, podId, clusterId, subject)); | ||
| logger.warn("alertType=[{}] dataCenter=[{}] pod=[{}] cluster=[{}] message=[{}].", alertType, dataCenter, pod, cluster, subject); |
| result.setResult(answer.getErrorString()); | ||
| caller.complete(result); | ||
| String msg = "Failed to register template: " + obj.getUuid() + " with error: " + answer.getErrorString(); | ||
| String msg = "Failed to register template: " + obj + " with error: " + answer.getErrorString(); |
| result.setResult(answer.getErrorString()); | ||
| caller.complete(result); | ||
| String msg = "Failed to upload volume: " + obj.getUuid() + " with error: " + answer.getErrorString(); | ||
| String msg = "Failed to upload volume: " + obj + " with error: " + answer.getErrorString(); |
| result.setResult(answer.getErrorString()); | ||
| caller.complete(result); | ||
| String msg = "Failed to copy snapshot: " + obj.getUuid() + " with error: " + answer.getErrorString(); | ||
| String msg = "Failed to copy snapshot: " + obj + " with error: " + answer.getErrorString(); |
| /** | ||
| * Shared formatting for the host/zone/pod description that recurs, independently | ||
| * hand-rolled and inconsistently worded (and occasionally mislabelled), across the | ||
| * HA and agent-management alert call sites. See CLOUDSTACK-7297. | ||
| */ |
Description
This PR...
Fixes: #7297
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?