This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 6f3c18f  alert: Send alert for ha'ed vm's (#5664)
6f3c18f is described below

commit 6f3c18f3a73db814e05bb19e236e0f795f4ebab1
Author: Rakesh <[email protected]>
AuthorDate: Thu Mar 17 04:52:35 2022 +0100

    alert: Send alert for ha'ed vm's (#5664)
    
    * alert: Send alert for ha'ed vm's
    
    When ha is performed on vm's send the alert for it so that
    its for admins to know which vm's got ha'ed else its time
    consuming to get those details from logs
    
    * feedback change
    
    Co-authored-by: Rakesh Venkatesh <[email protected]>
---
 server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java 
b/server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
index 82b378a..1b9b512 100644
--- a/server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
+++ b/server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
@@ -608,7 +608,10 @@ public class HighAvailabilityManagerImpl extends 
ManagerBase implements Configur
 
             VMInstanceVO started = _instanceDao.findById(vm.getId());
             if (started != null && started.getState() == 
VirtualMachine.State.Running) {
-                s_logger.info("VM is now restarted: " + vmId + " on " + 
started.getHostId());
+                String message = String.format("HA starting VM: %s (%s)", 
started.getHostName(), started.getInstanceName());
+                HostVO hostVmHasStarted = 
_hostDao.findById(started.getHostId());
+                s_logger.info(String.format("HA is now restarting %s on %s", 
started, hostVmHasStarted));
+                _alertMgr.sendAlert(alertType, vm.getDataCenterId(), 
vm.getPodIdToDeployIn(), message, message);
                 return null;
             }
 

Reply via email to