private String getDetailsURL(ResourceOperationHistory history) { String protocol; if (request.isSecure()) { protocol = "https"; } else { protocol = "http"; } return protocol + "://" + request.getServerName() + ":" + request.getServerPort() + "/coregui/#Resource/" + history.getResource().getId() + "/Operations/History/" + history.getId(); }
private void logError(ResourceOperationHistory operationHistory, String msg, Exception e) { log.error(msg, e); StorageNode storageNode = findStorageNode(operationHistory.getResource()); storageNodeOperationsHandler.logError(storageNode.getAddress(), msg, e); }
private void ensureControlPermission(Subject subject, OperationHistory history) throws PermissionException { if (history instanceof GroupOperationHistory) { ResourceGroup group = ((GroupOperationHistory) history).getGroup(); ensureControlPermission(subject, group); } else { Resource resource = ((ResourceOperationHistory) history).getResource(); ensureControlPermission(subject, resource); } }
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; }
int resourceId = doomedHistory.getResource().getId(); CancelResults results = null; AgentClient agent = null;
@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); } }
@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); } }
Resource resource = resourceHistory.getResource(); String name = resource.getName(); Map<Integer, String> ancestryMap = resourceManager
@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); } } }
private void ensureViewPermission(Subject subject, OperationHistory history) throws PermissionException { if (history instanceof GroupOperationHistory) { ResourceGroup group = ((GroupOperationHistory) history).getGroup(); if (!authorizationManager.canViewGroup(subject, group.getId())) { throw new PermissionException("User [" + subject.getName() + "] does not have permission to view operation history for group [" + group + "]"); } } else { Resource resource = ((ResourceOperationHistory) history).getResource(); if (!authorizationManager.canViewResource(subject, resource.getId())) { throw new PermissionException("User [" + subject.getName() + "] does not have permission to view operation history for resource [" + resource + "]"); } } }
if (history.getResource()!=null) { hist.setResourceName(history.getResource().getName());
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void handleAddNodeMaintenance(ResourceOperationHistory resourceOperationHistory) { StorageNode storageNode = findStorageNode(resourceOperationHistory.getResource()); Configuration parameters = resourceOperationHistory.getParameters(); String newNodeAddress = parameters.getSimpleValue("newNodeAddress");
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void handleRemoveNodeMaintenance(ResourceOperationHistory operationHistory) { StorageNode storageNode = findStorageNode(operationHistory.getResource()); Configuration parameters = operationHistory.getParameters(); String removedNodeAddress = parameters.getSimpleValue("removedNodeAddress");
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void handleAnnounce(ResourceOperationHistory resourceOperationHistory) { StorageNode storageNode = findStorageNode(resourceOperationHistory.getResource()); Configuration parameters = resourceOperationHistory.getParameters(); PropertyList addresses = parameters.getList("addresses");
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void handleUnannounce(ResourceOperationHistory operationHistory) { StorageNode storageNode = findStorageNode(operationHistory.getResource()); Configuration params = operationHistory.getParameters(); PropertyList addresses = params.getList("addresses");