Search in sources :

Example 16 with VdsIdVDSCommandParametersBase

use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.

the class GlusterHookSyncJob method refreshHooksInCluster.

/**
 * @param cluster - the Cluster for which the gluster hook data is refreshed
 * @param throwError - set to true if this method should throw exception.
 */
public void refreshHooksInCluster(Cluster cluster, boolean throwError) {
    if (!cluster.supportsGlusterService()) {
        return;
    }
    log.debug("Syncing hooks for cluster {}", cluster.getName());
    List<VDS> upServers = glusterUtil.getAllUpServers(cluster.getId());
    if (upServers == null || upServers.isEmpty()) {
        return;
    }
    List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<>();
    for (final VDS upServer : upServers) {
        taskList.add(() -> {
            VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterHooksList, new VdsIdVDSCommandParametersBase(upServer.getId()));
            return new Pair<>(upServer, returnValue);
        });
    }
    List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList);
    try {
        addOrUpdateHooks(cluster.getId(), pairResults);
    } catch (EngineException e) {
        if (throwError) {
            // propogate error to calling application.
            throw e;
        }
    }
}
Also used : VdsIdVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase) VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) EngineException(org.ovirt.engine.core.common.errors.EngineException) Callable(java.util.concurrent.Callable) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 17 with VdsIdVDSCommandParametersBase

use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.

the class SPMGetAllTasksInfoVDSCommand method executeIrsBrokerCommand.

@Override
protected void executeIrsBrokerCommand() {
    log.info("-- executeIrsBrokerCommand: Attempting on storage pool '{}'", getParameters().getStoragePoolId());
    setReturnValue(resourceManager.runVdsCommand(VDSCommandType.HSMGetAllTasksInfo, new VdsIdVDSCommandParametersBase(getCurrentIrsProxy().getCurrentVdsId())).getReturnValue());
}
Also used : VdsIdVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase)

Aggregations

VdsIdVDSCommandParametersBase (org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase)17 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)15 VDS (org.ovirt.engine.core.common.businessentities.VDS)6 List (java.util.List)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Guid (org.ovirt.engine.core.compat.Guid)4 EngineException (org.ovirt.engine.core.common.errors.EngineException)3 Collections (java.util.Collections)2 Map (java.util.Map)2 Callable (java.util.concurrent.Callable)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)2 Pair (org.ovirt.engine.core.common.utils.Pair)2 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)2 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)2 MessageFormat (java.text.MessageFormat)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1