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