Source:
protected void executeCommand() { EngineLock monitoring_lock = new EngineLock(Collections.singletonMap(getParameters().getVdsId().toString(), LockingGroup.VDS_INIT.name()), null); log.info("Before acquiring lock in order to prevent monitoring"); getLockManager().acquireLockWait(monitoring_lock); log.info("Lock acquired, from now a monitoring of host will be skipped"); try { final VDS vds = getVds(); ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintananceVds, false); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntityStatus(vds.getDynamicData(), vds.getstatus()); runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(getVdsId(), VDSStatus.Unassigned)); getCompensationContext().stateChanged(); return null; } }); setSucceeded(runVdsCommand(VDSCommandType.ActivateVds, new ActivateVdsVDSCommandParameters(getVdsId())) .getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = DbFacade.getInstance().getNetworkDao() .getAllForCluster(vds.getvds_group_id()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getvds_group_id(), net); } return null; } }); } } finally { getLockManager().releaseLock(monitoring_lock); log.info("Activate finished. Lock released. Monitoring can run now"); } }

Target:
protected void executeCommand() { final VDS vds = getVds(); EngineLock monitoringLock = new EngineLock(Collections.singletonMap(getParameters().getVdsId().toString(), LockingGroup.VDS_INIT.name()), null); log.infoFormat("Before acquiring lock in order to prevent monitoring for host {0} form pool {1}", vds.getName(), vds.getstorage_pool_name()); getLockManager().acquireLockWait(monitoringLock); log.infoFormat("Lock acquired, from now a monitoring of host will be skipped for host {0} form pool {1}", vds.getName(), vds.getstorage_pool_name()); try { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintananceVds, false); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntityStatus(vds.getDynamicData(), vds.getstatus()); runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(getVdsId(), VDSStatus.Unassigned)); getCompensationContext().stateChanged(); return null; } }); setSucceeded(runVdsCommand(VDSCommandType.ActivateVds, new ActivateVdsVDSCommandParameters(getVdsId())) .getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = DbFacade.getInstance().getNetworkDao() .getAllForCluster(vds.getvds_group_id()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getvds_group_id(), net); } return null; } }); } } finally { getLockManager().releaseLock(monitoringLock); log.infoFormat("Activate finished. Lock released. Monitoring can run now for host {0} form pool {1}", vds.getName(), vds.getstorage_pool_name()); } }