Source:
protected void executeCommand() { final VDS vds = getVds(); EngineLock monitoringLock = new EngineLock(Collections.singletonMap(getParameters().getVdsId().toString(), new Pair<String, String>(LockingGroup.VDS_INIT.name(), "")), null); log.infoFormat("Before acquiring lock in order to prevent monitoring for host {0} from data-center {1}", vds.getName(), vds.getStoragePoolName()); getLockManager().acquireLockWait(monitoringLock); log.infoFormat("Lock acquired, from now a monitoring of host will be skipped for host {0} from data-center {1}", vds.getName(), vds.getStoragePoolName()); try { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(getVdsId(), VDSStatus.Unassigned)); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ActivateVds, new ActivateVdsVDSCommandParameters(getVdsId())); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { if (FeatureSupported.setupNetworks(vds.getVdsGroupCompatibilityVersion())) { createManagementNetworkIfRequired((VDS) returnValue.getReturnValue()); } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = getNetworkDAO().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } return null; } }); } } finally { getLockManager().releaseLock(monitoringLock); log.infoFormat("Activate finished. Lock released. Monitoring can run now for host {0} from data-center {1}", vds.getName(), vds.getStoragePoolName()); } }

Target:
protected void executeCommand() { final VDS vds = getVds(); EngineLock monitoringLock = new EngineLock(Collections.singletonMap(getParameters().getVdsId().toString(), new Pair<String, String>(LockingGroup.VDS_INIT.name(), "")), null); log.infoFormat("Before acquiring lock in order to prevent monitoring for host {0} from data-center {1}", vds.getName(), vds.getStoragePoolName()); getLockManager().acquireLockWait(monitoringLock); log.infoFormat("Lock acquired, from now a monitoring of host will be skipped for host {0} from data-center {1}", vds.getName(), vds.getStoragePoolName()); try { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(getVdsId(), VDSStatus.Unassigned)); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ActivateVds, new ActivateVdsVDSCommandParameters(getVdsId())); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { createManagementNetworkIfRequired((VDS) returnValue.getReturnValue()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = getNetworkDAO().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } return null; } }); } } finally { getLockManager().releaseLock(monitoringLock); log.infoFormat("Activate finished. Lock released. Monitoring can run now for host {0} from data-center {1}", vds.getName(), vds.getStoragePoolName()); } }