use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.
the class FenceProxyLocator method areAgentsVersionCompatible.
protected boolean areAgentsVersionCompatible(VDS proxyCandidate) {
VdsFenceOptions options = createVdsFenceOptions(proxyCandidate.getClusterCompatibilityVersion().getValue());
boolean compatible = true;
for (FenceAgent agent : getDbFacade().getFenceAgentDao().getFenceAgentsForHost(fencedHost.getId())) {
if (!options.isAgentSupported(agent.getType())) {
compatible = false;
break;
}
}
log.debug("Proxy candidate '{}' has compatible fence agents: {}", proxyCandidate.getHostName(), compatible);
return compatible;
}
use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.
the class PmHealthCheckManager method collectHealthStatus.
/**
* A step in the health-status check. Checks health of the provided agents.
*/
private void collectHealthStatus(PmHealth healthStatus, List<FenceAgent> agents) {
// initialize to false, and if one healthy agent found, change to true.
boolean atLeastOneHealthy = false;
// initialize to true, and if one unhealthy agent found, change to false.
boolean allHealthy = true;
for (FenceAgent agent : agents) {
if (isHealthy(agent, healthStatus.getHost())) {
healthStatus.getHealthMap().put(agent, true);
atLeastOneHealthy = true;
} else {
healthStatus.getHealthMap().put(agent, false);
allHealthy = false;
}
}
if (atLeastOneHealthy) {
healthStatus.setStartShouldWork(true);
}
if (allHealthy) {
healthStatus.setStopShouldWork(true);
}
}
use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.
the class UpdateFenceAgentCommand method executeCommand.
@Override
protected void executeCommand() {
FenceAgent agent = getParameters().getAgent();
fenceAgentDao.update(agent);
setSucceeded(true);
}
use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.
the class RemoveFenceAgentCommand method validate.
@Override
protected boolean validate() {
if (getParameters() == null || getParameters().getAgent() == null || getParameters().getAgent().getId() == null) {
return failValidation(EngineMessage.VDS_REMOVE_FENCE_AGENT_ID_REQUIRED);
}
// check for removal of last fence agent while PM is enabled in the host
Guid vdsId = getParameters().getAgent().getHostId();
VDS host = vdsDao.get(vdsId);
if (host == null) {
return failValidation(EngineMessage.VDS_INVALID_SERVER_ID);
}
if (host.isPmEnabled()) {
List<FenceAgent> fenceAgents = fenceAgentDao.getFenceAgentsForHost(getVdsId());
if (fenceAgents.size() == 1) {
return failValidation(EngineMessage.VDS_REMOVE_LAST_FENCE_AGENT_PM_ENABLED);
}
}
return super.validate();
}
use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.
the class AddFenceAgentCommand method executeCommand.
@Override
protected void executeCommand() {
FenceAgent agent = getParameters().getAgent();
fenceAgentDao.save(agent);
getReturnValue().setActionReturnValue(agent.getId());
setSucceeded(true);
}
Aggregations