Search in sources :

Example 6 with FenceAgent

use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.

the class FenceAgentMapper method map.

@Mapping(from = Agent.class, to = FenceAgent.class)
public static FenceAgent map(Agent model, FenceAgent template) {
    FenceAgent entity = template != null ? template : new FenceAgent();
    if (model.isSetId()) {
        entity.setId(GuidUtils.asGuid(model.getId()));
    }
    if (model.isSetHost() && model.getHost().isSetId()) {
        entity.setHostId(new Guid(model.getHost().getId()));
    }
    if (model.isSetAddress()) {
        entity.setIp(model.getAddress());
    }
    if (model.isSetOrder()) {
        entity.setOrder(model.getOrder());
    }
    if (model.isSetType()) {
        entity.setType(model.getType());
    }
    if (model.isSetUsername()) {
        entity.setUser(model.getUsername());
    }
    if (model.isSetPassword()) {
        entity.setPassword(model.getPassword());
    }
    if (model.isSetPort()) {
        entity.setPort(model.getPort());
        addPortToOptions(model);
    }
    if (model.isSetOptions()) {
        entity.setOptions(HostMapper.map(model.getOptions(), null));
    }
    if (model.isSetEncryptOptions()) {
        entity.setEncryptOptions(model.isEncryptOptions());
    }
    return entity;
}
Also used : FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent) Guid(org.ovirt.engine.core.compat.Guid)

Example 7 with FenceAgent

use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.

the class AddVdsCommand method addFenceAgents.

private void addFenceAgents() {
    if (getParameters().getFenceAgents() != null) {
        // if == null, means no update. Empty list means
        for (FenceAgent agent : getParameters().getFenceAgents()) {
            agent.setHostId(getVdsId());
            fenceAgentDao.save(agent);
        }
    }
}
Also used : FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent)

Example 8 with FenceAgent

use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.

the class HostFenceActionExecutorTest method createFenceAgent.

protected FenceAgent createFenceAgent(int order) {
    FenceAgent agent = new FenceAgent();
    agent.setId(Guid.newGuid());
    agent.setOrder(order);
    return agent;
}
Also used : FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent)

Example 9 with FenceAgent

use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.

the class StartVdsCommandTest method initAgents.

private void initAgents() {
    agent1 = new FenceAgent();
    agent1.setOrder(1);
    agent2 = new FenceAgent();
    agent2.setOrder(2);
}
Also used : FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent)

Example 10 with FenceAgent

use of org.ovirt.engine.core.common.businessentities.pm.FenceAgent in project ovirt-engine by oVirt.

the class FenceValidatorTest method succeedWhenClusterVersionCompatible.

@Test
public void succeedWhenClusterVersionCompatible() {
    VDS vds = new VDS();
    vds.setPmEnabled(true);
    Cluster cluster = new Cluster();
    cluster.setCompatibilityVersion(Version.getLast());
    FenceAgent agent = new FenceAgent();
    agent.setType("apc");
    when(fenceAgentDao.getFenceAgentsForHost(vds.getId())).thenReturn(Collections.singletonList(agent));
    List<String> messages = new LinkedList<>();
    mcr.mockConfigValue(ConfigValues.VdsFenceType, Version.getLast(), "apc");
    mcr.mockConfigValue(ConfigValues.CustomVdsFenceType, "apc");
    boolean result = validator.isPowerManagementEnabledAndLegal(vds, cluster, messages);
    assertTrue(result);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) LinkedList(java.util.LinkedList) Test(org.junit.Test)

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