use of org.ovirt.engine.core.common.businessentities.FencingPolicy in project ovirt-engine by oVirt.
the class Cloner method cloneCluster.
private static Cluster cloneCluster(Cluster instance) {
Cluster obj = new Cluster();
obj.setId(instance.getId());
obj.setName(instance.getName());
obj.setDescription(instance.getDescription());
obj.setComment(instance.getComment());
obj.setCpuName(instance.getCpuName());
obj.setClusterCompatibilityLevelUpgradeNeeded(instance.isClusterCompatibilityLevelUpgradeNeeded());
obj.setCompatibilityVersion(instance.getCompatibilityVersion());
obj.setMigrateOnError(instance.getMigrateOnError());
obj.setTransparentHugepages(instance.getTransparentHugepages());
obj.setStoragePoolId(instance.getStoragePoolId());
obj.setMaxVdsMemoryOverCommit(instance.getMaxVdsMemoryOverCommit());
obj.setCountThreadsAsCores(instance.getCountThreadsAsCores());
obj.setEmulatedMachine(instance.getEmulatedMachine());
obj.setDetectEmulatedMachine(instance.isDetectEmulatedMachine());
obj.setArchitecture(instance.getArchitecture());
obj.setSerialNumberPolicy(instance.getSerialNumberPolicy());
obj.setCustomSerialNumber(instance.getCustomSerialNumber());
obj.setFencingPolicy(new FencingPolicy(instance.getFencingPolicy()));
obj.setAutoConverge(instance.getAutoConverge());
obj.setMigrateCompressed(instance.getMigrateCompressed());
return obj;
}
use of org.ovirt.engine.core.common.businessentities.FencingPolicy in project ovirt-engine by oVirt.
the class FenceProxyLocatorTest method findProxyHostExcludesHostDueToFencingPolicy.
/**
* Checks if the locator excludes specified host as a proxy host, because its supported cluster level is lower
* than minimal supported cluster level required by fencing policy. And because specified host is the only
* existing host, no proxy is selected
*/
@Test
public void findProxyHostExcludesHostDueToFencingPolicy() {
mockExistingHosts(createHost());
FenceProxyLocator locator = setupLocator(new FencingPolicy());
setMinSupportedVersionForFencingPolicy(locator, Version.v3_6);
VDS proxyHost = locator.findProxyHost(false);
assertNull(proxyHost);
}
use of org.ovirt.engine.core.common.businessentities.FencingPolicy in project ovirt-engine by oVirt.
the class VdsNotRespondingTreatmentCommand method executeCommand.
/**
* Only fence the host if the VDS is down, otherwise it might have gone back up until this command was executed. If
* the VDS is not fenced then don't send an audit log event.
*/
@Override
protected void executeCommand() {
VDS host = getVds();
if (!previousHostedEngineHost.isPreviousHostId(host.getId()) && !fenceValidator.isStartupTimeoutPassed() && !host.isInFenceFlow()) {
log.error("Failed to run Fence script on vds '{}'.", getVdsName());
alertIfPowerManagementOperationSkipped();
// If fencing can't be done and the host is the SPM, set storage-pool to non-operational
if (host.getSpmStatus() != VdsSpmStatus.None) {
setStoragePoolNonOperational();
}
return;
}
setVds(null);
if (getVds() == null) {
setCommandShouldBeLogged(false);
log.info("Host '{}' ({}) not fenced since it doesn't exist anymore.", getVdsName(), getVdsId());
getReturnValue().setSucceeded(false);
return;
}
if (shouldFencingBeSkipped(getVds())) {
setSucceeded(false);
setCommandShouldBeLogged(false);
return;
}
boolean shouldBeFenced = getVds().shouldVdsBeFenced();
ActionReturnValue restartVdsResult = null;
if (shouldBeFenced) {
getParameters().setParentCommand(ActionType.VdsNotRespondingTreatment);
ActionReturnValue retVal;
retVal = runInternalAction(ActionType.SshSoftFencing, getParameters(), cloneContext().withoutExecutionContext());
if (retVal.getSucceeded()) {
// SSH Soft Fencing was successful and host is Up, stop non responding treatment
getReturnValue().setSucceeded(true);
setCommandShouldBeLogged(false);
return;
}
// proceed with non responding treatment only if PM action are allowed and PM enabled for host
if (!monitoringStrategyFactory.getMonitoringStrategyForVds(getVds()).isPowerManagementSupported() || !getVds().isPmEnabled()) {
setSucceeded(false);
setCommandShouldBeLogged(false);
return;
}
retVal = runInternalAction(ActionType.VdsKdumpDetection, getParameters(), cloneContext().withoutExecutionContext());
if (retVal.getSucceeded()) {
// kdump on host detected and finished successfully, stop hard fencing execution
getReturnValue().setSucceeded(true);
return;
}
// load cluster fencing policy
FencingPolicy fencingPolicy = clusterDao.get(getVds().getClusterId()).getFencingPolicy();
getParameters().setFencingPolicy(fencingPolicy);
waitUntilSkipFencingIfSDActiveAllowed(fencingPolicy.isSkipFencingIfSDActive());
restartVdsResult = runInternalAction(ActionType.RestartVds, getParameters(), cloneContext().withoutExecutionContext());
} else {
setCommandShouldBeLogged(false);
log.info("Host '{}' ({}) not fenced since it's status is ok, or it doesn't exist anymore.", getVdsName(), getVdsId());
}
if (restartVdsResult != null && restartVdsResult.<RestartVdsResult>getActionReturnValue() != null && restartVdsResult.<RestartVdsResult>getActionReturnValue().isSkippedDueToFencingPolicy()) {
// fencing was skipped, fire an alert and suppress standard command logging
AuditLogable alb = createAuditLogableForHost(getVds());
auditLogDirector.log(alb, AuditLogType.VDS_ALERT_NOT_RESTARTED_DUE_TO_POLICY);
setSucceeded(false);
setCommandShouldBeLogged(false);
} else {
getReturnValue().setSucceeded(shouldBeFenced);
}
}
use of org.ovirt.engine.core.common.businessentities.FencingPolicy in project ovirt-engine by oVirt.
the class ConcurrentAgentsFenceActionExecutorTest method setup.
@Before
public void setup() {
agent1 = new FenceAgent();
agent1.setId(Guid.newGuid());
agent2 = new FenceAgent();
agent2.setId(Guid.newGuid());
List<FenceAgent> fenceAgents = new ArrayList<>();
fenceAgents.add(agent1);
fenceAgents.add(agent2);
executor = spy(new ConcurrentAgentsFenceActionExecutor(fencedHost, fenceAgents, new FencingPolicy()));
doReturn(singleExecutor1).when(executor).createFenceActionExecutor(eq(agent1));
doReturn(singleExecutor2).when(executor).createFenceActionExecutor(eq(agent2));
}
use of org.ovirt.engine.core.common.businessentities.FencingPolicy in project ovirt-engine by oVirt.
the class HostFenceActionExecutorTest method testSingleAgentFenceActionExecutorUsage.
/**
* Tests {@code SingleAgentFenceActionExecutor} creation for single fence agent
*/
@Test
public void testSingleAgentFenceActionExecutorUsage() {
HostFenceActionExecutor executor = new HostFenceActionExecutor(fencedHost, new FencingPolicy());
assertTrue(executor.createFenceActionExecutor(createSingleAgentList(1)) instanceof SingleAgentFenceActionExecutor);
}
Aggregations