if (resourceHistory.getStatus() == OperationRequestStatus.INPROGRESS) { stillInProgress = true; break; } else if ((resourceHistory.getStatus() == OperationRequestStatus.FAILURE) || (resourceHistory.getStatus() == OperationRequestStatus.CANCELED)) { groupStatus = OperationRequestStatus.FAILURE; if (groupErrorMessage == null) { ResourceAncestryFormat.SIMPLE); String ancestry = ancestryMap.isEmpty() ? "" : ancestryMap.get(resource.getId()); groupErrorMessage.append(name + " [" + ancestry + "] " + resourceHistory.getStatus().name());
public AlertConditionCacheStats checkConditions(OperationHistory operationHistory) { AlertConditionCacheStats stats = new AlertConditionCacheStats(); try { if (operationHistory instanceof ResourceOperationHistory) { ResourceOperationHistory resourceOperationHistory = (ResourceOperationHistory) operationHistory; Resource resource = resourceOperationHistory.getResource(); OperationDefinition operationDefinition = resourceOperationHistory.getOperationDefinition(); OperationRequestStatus operationStatus = resourceOperationHistory.getStatus(); List<ResourceOperationCacheElement> cacheElements = lookupResourceOperationHistoryCacheElements( resource.getId(), operationDefinition.getId()); processCacheElements(cacheElements, operationStatus, resourceOperationHistory.getModifiedTime(), stats); } else { if (log.isDebugEnabled()) log.debug(getClass().getSimpleName() + " does not support checking conditions against " + operationHistory.getClass().getSimpleName() + " types"); } AlertConditionCacheMonitor.getMBean().incrementOperationCacheElementMatches(stats.matched); AlertConditionCacheMonitor.getMBean().incrementOperationProcessingTime(stats.getAge()); if (log.isDebugEnabled()) log.debug("Check OperationHistory[size=1] - " + stats); } catch (Throwable t) { // don't let any exceptions bubble up to the calling SLSB layer log.error("Error during global cache processing: ", t); } return stats; }
builder = Response.ok(hist); if (history.getStatus()== OperationRequestStatus.SUCCESS) {
if (doomedHistory.getStatus() != OperationRequestStatus.INPROGRESS) { throw new IllegalStateException("The job is no longer in-progress - cannot cancel it: " + doomedHistory);
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void handleUninstall(ResourceOperationHistory operationHistory) { StorageNode storageNode = findStorageNode(operationHistory.getResource()); switch (operationHistory.getStatus()) { case INPROGRESS: // nothing to do here break; case CANCELED: undeploymentOperationCanceled(storageNode, operationHistory); break; case FAILURE: undeploymentOperationFailed(storageNode, operationHistory); break; default: // SUCCESS log.info("Successfully uninstalled " + storageNode + " from disk"); finishUninstall(getSubject(operationHistory), storageNode); } }
public void operationSucceeded(String jobId, Configuration result, long invocationTime, long completionTime) { LOG.debug("Operation invocation [" + jobId + "] succeeded " + getFromStartToEndTimestampString(invocationTime, completionTime)); try { Subject superuser = LookupUtil.getSubjectManager().getOverlord(); OperationManagerLocal operationManager = LookupUtil.getOperationManager(); ResourceOperationHistory history; history = (ResourceOperationHistory) operationManager.getOperationHistoryByJobId(superuser, jobId); // I think this will only ever occur if the server-side timed this out but the long running // operation finally got back to us afterwards. We will still go ahead and // persist the success data because, obviously, the operation really didn't time out. // I think, in reality, this condition will never occur (since the server-side will only ever // timeout ridiculously long-lived operations, which is typically only when an agent shutdown occurred). if (history.getStatus() != OperationRequestStatus.INPROGRESS) { LOG.debug("Was told an operation succeeded but, curiously, it was not in progress: " + "job-id=[" + jobId + "], op-history=[" + history + "]"); } history.setErrorMessage(null); history.setResults(result); history.setStatus(OperationRequestStatus.SUCCESS); operationManager.updateOperationHistory(superuser, history); operationManager.checkForCompletedGroupOperation(history.getId()); } catch (Exception e) { LOG.error("Failed to update history from successful operation, jobId=[" + jobId + "]. Cause: " + e, e); LOG.error("The successful operation [" + jobId + "] had results of: " + result); } }
if (history.getStatus() != OperationRequestStatus.INPROGRESS) { LOG.debug("Was told an operation failed but, curiously, it was not in progress: " + "job-id=[" + jobId + "], op-history=[" + history + "]");
if (history.getStatus() != OperationRequestStatus.INPROGRESS) { LOG.debug("Was told an operation was canceled but, curiously, it was not in progress: " + "job-id=[" + jobId + "], op-history=[" + history + "]");
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void handleDecommission(ResourceOperationHistory operationHistory) { StorageNode storageNode = findStorageNode(operationHistory.getResource()); switch (operationHistory.getStatus()) { case INPROGRESS: // nothing do to here break; case CANCELED: undeploymentOperationCanceled(storageNode, operationHistory); break; case FAILURE: undeploymentOperationFailed(storageNode, operationHistory); break; default: // SUCCESS log.info("Successfully decommissioned " + storageNode); storageNode = storageNodeOperationsHandler.setMode(storageNode, StorageNode.OperationMode.REMOVE_MAINTENANCE); Subject subject = getSubject(operationHistory); performRemoveMaintenance(subject, storageNode); } }
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void handlePrepareForBootstrap(ResourceOperationHistory operationHistory) { StorageNode newStorageNode = findStorageNode(operationHistory.getResource()); switch (operationHistory.getStatus()) { case INPROGRESS: // nothing to do here return; case CANCELED: deploymentOperationCanceled(newStorageNode, operationHistory); return; case FAILURE: deploymentOperationFailed(newStorageNode, operationHistory); return; default: // SUCCESS log.info("The prepare for bootstrap operation completed successfully for " + newStorageNode); newStorageNode = storageNodeOperationsHandler.setMode(newStorageNode, StorageNode.OperationMode.ADD_MAINTENANCE); Subject subject = getSubject(operationHistory); performAddMaintenance(subject, newStorageNode); } }
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void handleRepair(ResourceOperationHistory operationHistory) { StorageNode storageNode = findStorageNode(operationHistory.getResource()); switch (operationHistory.getStatus()) { case INPROGRESS: // nothing to do here break; case CANCELED: repairCanceled(storageNode, operationHistory); break; case FAILURE: repairFailed(storageNode, operationHistory); break; default: // SUCCESS log.info("Finished running repair on " + storageNode); storageNode.setMaintenancePending(false); storageNodeOperationsHandler.setMode(storageNode, StorageNode.OperationMode.NORMAL); StorageNode nextNode = takeFromMaintenanceQueue(); if (nextNode == null) { log.info("Finished running repair on storage cluster"); } else { nextNode = storageNodeOperationsHandler.setMode(nextNode, StorageNode.OperationMode.MAINTENANCE); runRepair(getSubject(operationHistory), nextNode); } } }
public ResourceOperationHistory waitForScheduledOperationToComplete(ResourceOperationSchedule schedule, long intervalDuration, int maxIntervals) throws InterruptedException { if (remoteClient == null) { throw new IllegalStateException("The waitForScheduledOperationToComplete() method requires a connection to the RHQ server."); } ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria(); criteria.addFilterJobId(schedule.getJobId()); criteria.addFilterResourceIds(schedule.getResource().getId()); criteria.addSortStartTime(PageOrdering.DESC); criteria.setPaging(0, 1); criteria.fetchOperationDefinition(true); criteria.fetchParameters(true); criteria.fetchResults(true); ResourceOperationHistory history = null; int i = 0; while(history == null && i < maxIntervals) { Thread.sleep(intervalDuration); PageList<ResourceOperationHistory> histories = remoteClient.getProxy(OperationManagerRemote.class) .findResourceOperationHistoriesByCriteria(remoteClient.getSubject(), criteria); if (histories.size() > 0 && histories.get(0).getStatus() != OperationRequestStatus.INPROGRESS) { history = histories.get(0); } ++i; } return history; }
StorageNode newStorageNode; switch (resourceOperationHistory.getStatus()) { case INPROGRESS:
StorageNode removedStorageNode; switch (operationHistory.getStatus()) { case INPROGRESS:
StorageNode newStorageNode; switch (resourceOperationHistory.getStatus()) { case INPROGRESS:
StorageNode removedStorageNode; switch (operationHistory.getStatus()) { case INPROGRESS:
PageList<ResourceOperationHistory> histories = operationManager .findResourceOperationHistoriesByCriteria(remoteClient.getSubject(), criteria); if (histories.size() > 0 && histories.get(0).getStatus() != OperationRequestStatus.INPROGRESS) { history = histories.get(0);