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);
}
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);
}
}
Aggregations