Source:
protected void executeCommand() { if (isAttachedStorageDomain() && checkForActiveVds() != null) { try { if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) { ReconstructMasterParameters tempVar = new ReconstructMasterParameters(getStoragePool().getId(), getStorageDomain().getId(), false); tempVar.setTransactionScopeOption(TransactionScopeOption.RequiresNew); runInternalAction(ActionType.ReconstructMasterDomain, tempVar); } DetachStorageDomainVDSCommandParameters tempVar2 = new DetachStorageDomainVDSCommandParameters( getStoragePool().getId(), getStorageDomain().getId(), Guid.Empty, -1); tempVar2.setForce(true); runVdsCommand(VDSCommandType.DetachStorageDomain, tempVar2); } catch (RuntimeException ex) { log.error("Could not force detach storage domain '{}': {}", getStorageDomain().getStorageName(), ex.getMessage()); log.debug("Exception", ex); } } releaseStorageDomainMacPool(getVmsOnlyOnStorageDomain()); storageHelperDirector.getItem(getStorageDomain().getStorageType()) .storageDomainRemoved(getStorageDomain().getStorageStaticData()); storageDomainDao.remove(getStorageDomain().getId()); if (isAttachedStorageDomain()) { if (getStorageDomain().getStorageDomainType() == StorageDomainType.ISO) { runVdsCommand(VDSCommandType.ResetISOPath, new IrsBaseVDSCommandParameters(getStoragePool().getId())); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) { calcStoragePoolStatusByDomainsStatus(); } } setSucceeded(true); }

Target:
protected void executeCommand() { if (isAttachedStorageDomain() && checkForActiveVds() != null) { try { if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) { ReconstructMasterParameters tempVar = new ReconstructMasterParameters(getStoragePool().getId(), getStorageDomain().getId(), false); tempVar.setTransactionScopeOption(TransactionScopeOption.RequiresNew); runInternalAction(ActionType.ReconstructMasterDomain, tempVar); } DetachStorageDomainVDSCommandParameters tempVar2 = new DetachStorageDomainVDSCommandParameters( getStoragePool().getId(), getStorageDomain().getId(), Guid.Empty, -1); tempVar2.setForce(true); runVdsCommand(VDSCommandType.DetachStorageDomain, tempVar2); } catch (RuntimeException ex) { log.error("Could not force detach storage domain '{}': {}", getStorageDomain().getStorageName(), ex.getMessage()); log.debug("Exception", ex); } } else { log.info("Avoid running host operations like reconstruct/detach on force remove for storage domain '{}'." + "Storage domain attached to pool: '{}'" + "Active Vds: '{}'", getStorageDomain().getStorageName(), isAttachedStorageDomain(), checkForActiveVds()); } releaseStorageDomainMacPool(getVmsOnlyOnStorageDomain()); storageHelperDirector.getItem(getStorageDomain().getStorageType()) .storageDomainRemoved(getStorageDomain().getStorageStaticData()); storageDomainDao.remove(getStorageDomain().getId()); if (isAttachedStorageDomain()) { if (getStorageDomain().getStorageDomainType() == StorageDomainType.ISO) { runVdsCommand(VDSCommandType.ResetISOPath, new IrsBaseVDSCommandParameters(getStoragePool().getId())); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) { calcStoragePoolStatusByDomainsStatus(); } } setSucceeded(true); }