Skip to content

Commit 9194370

Browse files
committed
Fixup alerting and logging error in BGPServiceImpl
1 parent 96b757c commit 9194370

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Diff for: server/src/main/java/com/cloud/alert/AlertManagerImpl.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -738,13 +738,14 @@ public void sendAlert(AlertType alertType, DataCenter dataCenter, Pod pod, Clust
738738
AlertVO alert = null;
739739
Long clusterId = cluster == null ? null : cluster.getId();
740740
Long podId = pod == null ? null : pod.getId();
741+
long dcId = dataCenter == null ? 0L : dataCenter.getId();
741742
if ((alertType != AlertManager.AlertType.ALERT_TYPE_HOST) && (alertType != AlertManager.AlertType.ALERT_TYPE_USERVM)
742743
&& (alertType != AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER) && (alertType != AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY)
743744
&& (alertType != AlertManager.AlertType.ALERT_TYPE_SSVM) && (alertType != AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC)
744745
&& (alertType != AlertManager.AlertType.ALERT_TYPE_MANAGEMENT_NODE) && (alertType != AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED)
745746
&& (alertType != AlertManager.AlertType.ALERT_TYPE_UPLOAD_FAILED) && (alertType != AlertManager.AlertType.ALERT_TYPE_OOBM_AUTH_ERROR)
746747
&& (alertType != AlertManager.AlertType.ALERT_TYPE_HA_ACTION) && (alertType != AlertManager.AlertType.ALERT_TYPE_CA_CERT)) {
747-
alert = _alertDao.getLastAlert(alertType.getType(), dataCenter.getId(), podId, clusterId);
748+
alert = _alertDao.getLastAlert(alertType.getType(), dcId, podId, clusterId);
748749
}
749750

750751
if (alert == null) {
@@ -754,7 +755,7 @@ public void sendAlert(AlertType alertType, DataCenter dataCenter, Pod pod, Clust
754755
newAlert.setContent(content);
755756
newAlert.setClusterId(clusterId);
756757
newAlert.setPodId(podId);
757-
newAlert.setDataCenterId(dataCenter.getId());
758+
newAlert.setDataCenterId(dcId);
758759
newAlert.setSentCount(1);
759760
newAlert.setLastSent(new Date());
760761
newAlert.setName(alertType.getName());

Diff for: server/src/main/java/com/cloud/bgp/BGPServiceImpl.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ public boolean allocateASNumber(long zoneId, Long asNumber, Long networkId, Long
255255
netName = network.getName();
256256
}
257257

258-
LOGGER.debug("Allocating the AS Number {} to {} on zone {}", asNumber::toString,
259-
(Objects.nonNull(vpcId) ? "VPC " + vpc : "network " + network)::toString,
260-
() -> dataCenterDao.findById(zoneId));
258+
String logMsg = Objects.nonNull(vpcId) ? ("VPC " + vpc) : ("network " + network);
259+
LOGGER.debug("Allocating the AS Number {} to {} on zone {}", asNumberVO::toString,
260+
logMsg::toString, () -> dataCenterDao.findById(zoneId));
261261
asNumberVO.setAllocated(true);
262262
asNumberVO.setAllocatedTime(new Date());
263263
if (Objects.nonNull(vpcId)) {

0 commit comments

Comments
 (0)