Source:
protected void executeCommand() { setVds(null); if (getVds() == null) { setCommandShouldBeLogged(false); log.infoFormat("Host {0}({1}) not fenced since it doesn't exist anymore.", getVdsName(), getVdsId()); getReturnValue().setSucceeded(false); return; } VdsValidator validator = new VdsValidator(getVds()); boolean shouldBeFenced = validator.shouldVdsBeFenced(); if (shouldBeFenced) { getParameters().setParentCommand(VdcActionType.VdsNotRespondingTreatment); VdcReturnValueBase retVal = runInternalAction(VdcActionType.VdsKdumpDetection, getParameters(), getContext()); if (retVal.getSucceeded()) { getReturnValue().setSucceeded(true); return; } FencingPolicy fencingPolicy = getDbFacade().getVdsGroupDao().get( getVds().getVdsGroupId() ).getFencingPolicy(); getParameters().setFencingPolicy(fencingPolicy); if (fencingPolicy.isSkipFencingIfSDActive()) { long interval = Config.<Integer>getValue(ConfigValues.HostStorageLeaseAliveCheckingInterval) * 1000; long difference = System.currentTimeMillis() - getParameters().getLastUpdate(); if (difference < interval) { int sleepMs = (int)(interval - difference); log.debug(String.format("Sleeping %s ms before proceeding with fence execution", sleepMs)); ThreadUtils.sleep(sleepMs); } } ExecutionContext ec = (ExecutionContext) ObjectUtils.clone(this.getExecutionContext()); if (ec != null) { ec.setJob(this.getExecutionContext().getJob()); super.executeCommand(); this.setExecutionContext(ec); } else { super.executeCommand(); if (this.getExecutionContext() != null) { this.getExecutionContext().setJob(getDbFacade().getJobDao().get(this.getJobId())); } } } else { setCommandShouldBeLogged(false); log.infoFormat("Host {0}({1}) not fenced since it's status is ok, or it doesn't exist anymore.", getVdsName(), getVdsId()); } getReturnValue().setSucceeded(shouldBeFenced); }

Target:
protected void executeCommand() { setVds(null); if (getVds() == null) { setCommandShouldBeLogged(false); log.infoFormat("Host {0}({1}) not fenced since it doesn't exist anymore.", getVdsName(), getVdsId()); getReturnValue().setSucceeded(false); return; } VdsValidator validator = new VdsValidator(getVds()); boolean shouldBeFenced = validator.shouldVdsBeFenced(); if (shouldBeFenced) { getParameters().setParentCommand(VdcActionType.VdsNotRespondingTreatment); VdcReturnValueBase retVal = runInternalAction(VdcActionType.VdsKdumpDetection, getParameters(), getContext()); if (retVal.getSucceeded()) { getReturnValue().setSucceeded(true); return; } FencingPolicy fencingPolicy = getDbFacade().getVdsGroupDao().get( getVds().getVdsGroupId() ).getFencingPolicy(); getParameters().setFencingPolicy(fencingPolicy); if (fencingPolicy.isSkipFencingIfSDActive()) { long interval = TimeUnit.SECONDS.toMillis( Config.<Integer>getValue(ConfigValues.HostStorageLeaseAliveCheckingInterval)); long difference = System.currentTimeMillis() - getParameters().getLastUpdate(); if (difference < interval) { int sleepMs = (int)(interval - difference); log.debug(String.format("Sleeping %s ms before proceeding with fence execution", sleepMs)); ThreadUtils.sleep(sleepMs); } } ExecutionContext ec = (ExecutionContext) ObjectUtils.clone(this.getExecutionContext()); if (ec != null) { ec.setJob(this.getExecutionContext().getJob()); super.executeCommand(); this.setExecutionContext(ec); } else { super.executeCommand(); if (this.getExecutionContext() != null) { this.getExecutionContext().setJob(getDbFacade().getJobDao().get(this.getJobId())); } } } else { setCommandShouldBeLogged(false); log.infoFormat("Host {0}({1}) not fenced since it's status is ok, or it doesn't exist anymore.", getVdsName(), getVdsId()); } getReturnValue().setSucceeded(shouldBeFenced); }