public ManagementServerHostPeerVO(long ownerMshost, long peerMshost, long peerRunid, ManagementServerHost.State peerState) { this.ownerMshost = ownerMshost; this.peerMshost = peerMshost; this.peerRunid = peerRunid; this.peerState = peerState; lastUpdateTime = DateUtil.currentGMTTime(); }
public CommandExecLogVO(long hostId, long instanceId, String commandName, int weight) { this.hostId = hostId; this.instanceId = instanceId; this.commandName = commandName; this.weight = weight; this.created = DateUtil.currentGMTTime(); }
public AsyncJobJoinMapVO() { created = DateUtil.currentGMTTime(); lastUpdated = DateUtil.currentGMTTime(); }
public AsyncJobJournalVO() { created = DateUtil.currentGMTTime(); }
private List<VMInstanceVO> getVmsOnHost(long hostId) { List<VMInstanceVO> vms = vmInstanceDao.listUpByHostId(hostId); List<VMInstanceVO> vmsByLastHostId = vmInstanceDao.listByLastHostId(hostId); if (vmsByLastHostId.size() > 0) { // check if any VMs are within skip.counting.hours, if yes we have to consider the host. for (VMInstanceVO stoppedVM : vmsByLastHostId) { long secondsSinceLastUpdate = (DateUtil.currentGMTTime().getTime() - stoppedVM.getUpdateTime().getTime()) / 1000; if (secondsSinceLastUpdate < capacityReleaseInterval) { vms.add(stoppedVM); } } } return vms; }
private List<VMInstanceVO> getVmsOnHost(long hostId) { List<VMInstanceVO> vms = _vmInstanceDao.listUpByHostId(hostId); List<VMInstanceVO> vmsByLastHostId = _vmInstanceDao.listByLastHostId(hostId); if (vmsByLastHostId.size() > 0) { // check if any VMs are within skip.counting.hours, if yes we have to consider the host. for (VMInstanceVO stoppedVM : vmsByLastHostId) { long secondsSinceLastUpdate = (DateUtil.currentGMTTime().getTime() - stoppedVM.getUpdateTime().getTime()) / 1000; if (secondsSinceLastUpdate < capacityReleaseInterval) { vms.add(stoppedVM); } } } return vms; }
private List<UserVmVO> getVmsOnHost(long hostId) { List<UserVmVO> vms = _userVmDao.listUpByHostId(hostId); List<UserVmVO> vmsByLastHostId = _userVmDao.listByLastHostId(hostId); if (vmsByLastHostId.size() > 0) { // check if any VMs are within skip.counting.hours, if yes we have to consider the host. for (UserVmVO stoppedVM : vmsByLastHostId) { long secondsSinceLastUpdate = (DateUtil.currentGMTTime().getTime() - stoppedVM.getUpdateTime().getTime()) / 1000; if (secondsSinceLastUpdate < capacityReleaseInterval) { vms.add(stoppedVM); } } } return vms; }
@Override protected void runInContext() { s_logger.trace("VM Operation Thread Running"); try { _workDao.cleanup(VmOpCleanupWait.value()); final Date cutDate = new Date(DateUtil.currentGMTTime().getTime() - VmOpCleanupInterval.value() * 1000); _workJobDao.expungeCompletedWorkJobs(cutDate); } catch (final Exception e) { s_logger.error("VM Operations failed due to ", e); } } }
public boolean isManagementNodeAlive(final long msid) { final ManagementServerHostVO mshost = _mshostDao.findByMsid(msid); if (mshost != null) { if (mshost.getLastUpdateTime().getTime() >= DateUtil.currentGMTTime().getTime() - HeartbeatThreshold.value()) { return true; } } return false; }
@Override public List<ProjectInvitationVO> listInvitationsToExpire(long timeOut) { SearchCriteria<ProjectInvitationVO> sc = InactiveSearch.create(); sc.setParameters("created", new Date((DateUtil.currentGMTTime().getTime()) - timeOut)); sc.setParameters("state", State.Pending); return listBy(sc); }
private synchronized Map<Long, ZoneHostInfo> getZoneHostInfo() { Date cutTime = DateUtil.currentGMTTime(); List<RunningHostCountInfo> l = _hostDao.getRunningHostCounts(new Date(cutTime.getTime() - ClusterManager.HeartbeatThreshold.value())); RunningHostInfoAgregator aggregator = new RunningHostInfoAgregator(); if (l.size() > 0) { for (RunningHostCountInfo countInfo : l) { aggregator.aggregate(countInfo); } } return aggregator.getZoneHostInfoMap(); }
@Override public boolean isActive(long id, long timeout) { SearchCriteria<ProjectInvitationVO> sc = InactiveSearch.create(); sc.setParameters("id", id); if (findOneBy(sc) == null) { s_logger.warn("Unable to find project invitation by id " + id); return false; } sc.setParameters("created", new Date((DateUtil.currentGMTTime().getTime()) - timeout)); if (findOneBy(sc) == null) { return true; } else { return false; } }
@Override public AsyncJob queryJob(final long jobId, final boolean updatePollTime) { final AsyncJobVO job = _jobDao.findByIdIncludingRemoved(jobId); if (updatePollTime) { job.setLastPolled(DateUtil.currentGMTTime()); _jobDao.update(jobId, job); } return job; }
@Override public void doInTransactionWithoutResult(TransactionStatus status) { VMInstanceVO instance = findById(instanceId); if (instance != null) { instance.setPowerStateUpdateCount(0); instance.setPowerStateUpdateTime(DateUtil.currentGMTTime()); update(instanceId, instance); } } });
@Override public void doInTransactionWithoutResult(TransactionStatus status) { job.setProcessStatus(processStatus); if (resultObject != null) { job.setResult(resultObject); } job.setLastUpdated(DateUtil.currentGMTTime()); _jobDao.update(jobId, job); } });
@Override public void updateStep(long workJobId, Step step) { VmWorkJobVO jobVo = findById(workJobId); jobVo.setStep(step); jobVo.setLastUpdated(DateUtil.currentGMTTime()); update(workJobId, jobVo); }
private void scanStalledVMInTransitionStateOnDisconnectedHosts() { final Date cutTime = new Date(DateUtil.currentGMTTime().getTime() - VmOpWaitInterval.value() * 1000); final List<Long> stuckAndUncontrollableVMs = listStalledVMInTransitionStateOnDisconnectedHosts(cutTime); for (final Long vmId : stuckAndUncontrollableVMs) { final VMInstanceVO vm = _vmDao.findById(vmId); // We now only alert administrator about this situation _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SYNC, vm.getDataCenterId(), vm.getPodIdToDeployIn(), VM_SYNC_ALERT_SUBJECT, "VM " + vm.getHostName() + "(" + vm.getInstanceName() + ") is stuck in " + vm.getState() + " state and its host is unreachable for too long"); } }
@Override public void doInTransactionWithoutResult(TransactionStatus status) { AsyncJobVO job = _jobDao.createForUpdate(); job.setInstanceType(instanceType); job.setInstanceId(instanceId); job.setLastUpdated(DateUtil.currentGMTTime()); _jobDao.update(jobId, job); } });
@Override public void doInTransactionWithoutResult(TransactionStatus status) { SearchCriteria<VMInstanceVO> sc = createSearchCriteria(); sc.addAnd("powerHostId", SearchCriteria.Op.EQ, hostId); VMInstanceVO instance = createForUpdate(); instance.setPowerStateUpdateCount(0); instance.setPowerStateUpdateTime(DateUtil.currentGMTTime()); update(instance, sc); } });
@Override public void completeJoin(long joinJobId, JobInfo.Status joinStatus, String joinResult, long completeMsid) { AsyncJobJoinMapVO record = createForUpdate(); record.setJoinStatus(joinStatus); record.setJoinResult(joinResult); record.setCompleteMsid(completeMsid); record.setLastUpdated(DateUtil.currentGMTTime()); UpdateBuilder ub = getUpdateBuilder(record); SearchCriteria<AsyncJobJoinMapVO> sc = CompleteJoinSearch.create(); sc.setParameters("joinJobId", joinJobId); update(ub, sc, null); }