Skip to content
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

Fixup alerting and logging error in BGPServiceImpl #10252

Merged
merged 3 commits into from
Feb 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixup alerting and logging error in BGPServiceImpl
vishesh92 committed Jan 23, 2025
commit 91943705a93da923d851fc314778b3543b7a4e6d
5 changes: 3 additions & 2 deletions server/src/main/java/com/cloud/alert/AlertManagerImpl.java
Original file line number Diff line number Diff line change
@@ -738,13 +738,14 @@ public void sendAlert(AlertType alertType, DataCenter dataCenter, Pod pod, Clust
AlertVO alert = null;
Long clusterId = cluster == null ? null : cluster.getId();
Long podId = pod == null ? null : pod.getId();
long dcId = dataCenter == null ? 0L : dataCenter.getId();
if ((alertType != AlertManager.AlertType.ALERT_TYPE_HOST) && (alertType != AlertManager.AlertType.ALERT_TYPE_USERVM)
&& (alertType != AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER) && (alertType != AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY)
&& (alertType != AlertManager.AlertType.ALERT_TYPE_SSVM) && (alertType != AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC)
&& (alertType != AlertManager.AlertType.ALERT_TYPE_MANAGEMENT_NODE) && (alertType != AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED)
&& (alertType != AlertManager.AlertType.ALERT_TYPE_UPLOAD_FAILED) && (alertType != AlertManager.AlertType.ALERT_TYPE_OOBM_AUTH_ERROR)
&& (alertType != AlertManager.AlertType.ALERT_TYPE_HA_ACTION) && (alertType != AlertManager.AlertType.ALERT_TYPE_CA_CERT)) {
alert = _alertDao.getLastAlert(alertType.getType(), dataCenter.getId(), podId, clusterId);
alert = _alertDao.getLastAlert(alertType.getType(), dcId, podId, clusterId);
}

if (alert == null) {
@@ -754,7 +755,7 @@ public void sendAlert(AlertType alertType, DataCenter dataCenter, Pod pod, Clust
newAlert.setContent(content);
newAlert.setClusterId(clusterId);
newAlert.setPodId(podId);
newAlert.setDataCenterId(dataCenter.getId());
newAlert.setDataCenterId(dcId);
newAlert.setSentCount(1);
newAlert.setLastSent(new Date());
newAlert.setName(alertType.getName());
6 changes: 3 additions & 3 deletions server/src/main/java/com/cloud/bgp/BGPServiceImpl.java
Original file line number Diff line number Diff line change
@@ -255,9 +255,9 @@
netName = network.getName();
}

LOGGER.debug("Allocating the AS Number {} to {} on zone {}", asNumber::toString,
(Objects.nonNull(vpcId) ? "VPC " + vpc : "network " + network)::toString,
() -> dataCenterDao.findById(zoneId));
String logMsg = Objects.nonNull(vpcId) ? ("VPC " + vpc) : ("network " + network);
LOGGER.debug("Allocating the AS Number {} to {} on zone {}", asNumberVO::toString,
logMsg::toString, () -> dataCenterDao.findById(zoneId));

Check warning on line 260 in server/src/main/java/com/cloud/bgp/BGPServiceImpl.java

Codecov / codecov/patch

server/src/main/java/com/cloud/bgp/BGPServiceImpl.java#L259-L260

Added lines #L259 - L260 were not covered by tests
asNumberVO.setAllocated(true);
asNumberVO.setAllocatedTime(new Date());
if (Objects.nonNull(vpcId)) {