Skip to content

Commit 51f7677

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

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

server/src/main/java/com/cloud/alert/AlertManagerImpl.java

Lines changed: 3 additions & 2 deletions
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());

server/src/main/java/com/cloud/bgp/BGPServiceImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ 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,
258+
VpcVO finalVpc = vpc;
259+
NetworkVO finalNetwork = network;
260+
LOGGER.debug("Allocating the AS Number {} to {} on zone {}", asNumberVO::toString,
261+
() -> (Objects.nonNull(vpcId) ? ("VPC " + finalVpc) : ("network " + finalNetwork)),
260262
() -> dataCenterDao.findById(zoneId));
261263
asNumberVO.setAllocated(true);
262264
asNumberVO.setAllocatedTime(new Date());

0 commit comments

Comments
 (0)