Skip to content

Commit 2146194

Browse files
author
Marcus Sorensen
committed
Publish event for VM.STOP when out of band stop is detected
Signed-off-by: Marcus Sorensen <mls@apple.com>
1 parent f7345e8 commit 2146194

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import javax.naming.ConfigurationException;
4848
import javax.persistence.EntityExistsException;
4949

50+
import com.cloud.event.ActionEventUtils;
5051
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
5152
import org.apache.cloudstack.annotation.AnnotationService;
5253
import org.apache.cloudstack.annotation.dao.AnnotationDao;
@@ -4804,6 +4805,8 @@ private void handlePowerOnReportWithNoPendingJobsOnVM(final VMInstanceVO vm) {
48044805
VM_SYNC_ALERT_SUBJECT, "VM " + vm.getHostName() + "(" + vm.getInstanceName() + ") state is sync-ed (" + vm.getState()
48054806
+ " -> Running) from out-of-context transition. VM network environment may need to be reset");
48064807

4808+
ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, vm.getDomainId(),
4809+
EventTypes.EVENT_VM_START, "Out of band VM power on", vm.getId(), ApiCommandResourceType.VirtualMachine.toString());
48074810
s_logger.info("VM " + vm.getInstanceName() + " is sync-ed to at Running state according to power-on report from hypervisor");
48084811
break;
48094812

@@ -4837,6 +4840,8 @@ private void handlePowerOffReportWithNoPendingJobsOnVM(final VMInstanceVO vm) {
48374840
case Stopping:
48384841
case Running:
48394842
case Stopped:
4843+
ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM,vm.getDomainId(),
4844+
EventTypes.EVENT_VM_STOP, "Out of band VM power off", vm.getId(), ApiCommandResourceType.VirtualMachine.toString());
48404845
case Migrating:
48414846
if (s_logger.isInfoEnabled()) {
48424847
s_logger.info(

0 commit comments

Comments
 (0)