Search in sources :

Example 16 with FenceAgent

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;
}
Also used : FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent) VdsFenceOptions(org.ovirt.engine.core.utils.pm.VdsFenceOptions)

Example 17 with FenceAgent

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);
    }
}
Also used : FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent)

Example 18 with FenceAgent

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);
}
Also used : FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent)

Example 19 with FenceAgent

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();
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent) Guid(org.ovirt.engine.core.compat.Guid)

Example 20 with FenceAgent

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);
}
Also used : FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent)

Aggregations

FenceAgent (org.ovirt.engine.core.common.businessentities.pm.FenceAgent)27 VDS (org.ovirt.engine.core.common.businessentities.VDS)5 Guid (org.ovirt.engine.core.compat.Guid)5 ArrayList (java.util.ArrayList)4 LinkedList (java.util.LinkedList)4 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)4 Comparator (java.util.Comparator)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Test (org.junit.Test)2 Window (com.google.gwt.user.client.Window)1 Inject (com.google.inject.Inject)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Before (org.junit.Before)1