Search in sources :

Example 1 with MomPolicyVDSParameters

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

the class UpdateMomPolicyCommand method executeCommand.

@Override
protected void executeCommand() {
    boolean succeeded = false;
    try {
        succeeded = runVdsCommand(VDSCommandType.SetMOMPolicyParameters, new MomPolicyVDSParameters(getVds(), getCluster().isEnableBallooning(), getCluster().isEnableKsm(), getCluster().isKsmMergeAcrossNumaNodes())).getSucceeded();
    } catch (EngineException e) {
        log.error("Could not update MoM policy on host '{}': {}", getVdsName(), e.getMessage());
        log.debug("Exception", e);
    }
    getReturnValue().setSucceeded(succeeded);
}
Also used : MomPolicyVDSParameters(org.ovirt.engine.core.common.vdscommands.MomPolicyVDSParameters) EngineException(org.ovirt.engine.core.common.errors.EngineException)

Example 2 with MomPolicyVDSParameters

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

the class VdsEventListener method onMomPolicyChange.

// TODO asynch event handler - design infra code to allow async events in segregated thread
public void onMomPolicyChange(@Observes @MomPolicyUpdate final Cluster cluster) {
    if (cluster == null) {
        return;
    }
    List<VDS> activeHostsInCluster = vdsDao.getAllForClusterWithStatus(cluster.getId(), VDSStatus.Up);
    // collect all Active hosts into a callable list
    List<Callable<Object>> callables = new LinkedList<>();
    for (final VDS vds : activeHostsInCluster) {
        callables.add(() -> {
            try {
                resourceManagerProvider.get().runVdsCommand(VDSCommandType.SetMOMPolicyParameters, new MomPolicyVDSParameters(vds, cluster.isEnableBallooning(), cluster.isEnableKsm(), cluster.isKsmMergeAcrossNumaNodes()));
            } catch (EngineException e) {
                log.error("Could not update MoM policy on host '{}'", vds.getName());
            }
            return null;
        });
    }
    // run all VDSCommands concurrently with executor
    if (callables.size() > 0) {
        ThreadPoolUtil.invokeAll(callables);
    }
}
Also used : MomPolicyVDSParameters(org.ovirt.engine.core.common.vdscommands.MomPolicyVDSParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) EngineException(org.ovirt.engine.core.common.errors.EngineException) Callable(java.util.concurrent.Callable) LinkedList(java.util.LinkedList)

Aggregations

EngineException (org.ovirt.engine.core.common.errors.EngineException)2 MomPolicyVDSParameters (org.ovirt.engine.core.common.vdscommands.MomPolicyVDSParameters)2 LinkedList (java.util.LinkedList)1 Callable (java.util.concurrent.Callable)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1