CLOUDSTACK-8054: No event generated on host maintenance mode is completed Added events for host maintenance start and completion
(cherry picked from commit f6854bc9844ce94815b99032d508bda43ac1a0c1) Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/37cdb4ec Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/37cdb4ec Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/37cdb4ec Branch: refs/heads/4.5 Commit: 37cdb4eccacca005bc8a301921da96bec2f0838d Parents: cc31571 Author: Koushik Das <kous...@apache.org> Authored: Wed Dec 10 10:18:34 2014 +0530 Committer: Rohit Yadav <rohit.ya...@shapeblue.com> Committed: Tue Jan 20 10:23:37 2015 +0530 ---------------------------------------------------------------------- server/src/com/cloud/resource/ResourceManagerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37cdb4ec/server/src/com/cloud/resource/ResourceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 77f6041..5a1b8ce 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -31,6 +31,7 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; import com.cloud.vm.VirtualMachine; + import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd; import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd; @@ -93,7 +94,9 @@ import com.cloud.dc.dao.HostPodDao; import com.cloud.deploy.PlannerHostReservationVO; import com.cloud.deploy.dao.PlannerHostReservationDao; import com.cloud.event.ActionEvent; +import com.cloud.event.ActionEventUtils; import com.cloud.event.EventTypes; +import com.cloud.event.EventVO; import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.DiscoveryException; import com.cloud.exception.InvalidParameterValueException; @@ -1188,6 +1191,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager, throw new CloudRuntimeException(err + e.getMessage()); } + ActionEventUtils.onStartedActionEvent(CallContext.current().getCallingUserId(), CallContext.current().getCallingAccountId(), EventTypes.EVENT_MAINTENANCE_PREPARE, "starting maintenance for host " + hostId, true, 0); _agentMgr.pullAgentToMaintenance(hostId); /* TODO: move below to listener */ @@ -1270,6 +1274,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager, if (vos.isEmpty() && vosMigrating.isEmpty()) { resourceStateTransitTo(host, ResourceState.Event.InternalEnterMaintenance, _nodeId); hostInMaintenance = true; + ActionEventUtils.onCompletedActionEvent(CallContext.current().getCallingUserId(), CallContext.current().getCallingAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_MAINTENANCE_PREPARE, "completed maintenance for host " + hostId, 0); } } } catch (NoTransitionException e) {