Source:
protected boolean canDoAction() { boolean returnValue = super.canDoAction() && checkStoragePool() && CheckStoragePoolStatusNotEqual(StoragePoolStatus.Up, VdcBllMessages.ERROR_CANNOT_REMOVE_ACTIVE_STORAGE_POOL); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__STORAGE__POOL); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); if (!returnValue) { return false; } if (getStoragePool().getstatus() != StoragePoolStatus.Uninitialized && !getParameters().getForceDelete() && !InitializeVds()) { return false; } final List<storage_domains> poolDomains = DbFacade.getInstance().getStorageDomainDAO().getAllForStoragePool( getStoragePool().getId()); final List<storage_domains> activeOrLockedDomains = getActiveOrLockedDomainList(poolDomains); if (!activeOrLockedDomains.isEmpty()) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_POOL_WITH_ACTIVE_DOMAINS); return false; } if (!getParameters().getForceDelete()) { if(poolDomains.size() > 1) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_DOMAINS); return false; } for (storage_domains domain : poolDomains) { if ((domain.getstorage_domain_type() == StorageDomainType.Data || domain.getstorage_domain_type() == StorageDomainType.Master) && DbFacade.getInstance() .getDiskImageDAO() .getAllSnapshotsForStorageDomain(domain.getId()) .size() != 0) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_IMAGES); return false; } } final List<VmStatic> vms = DbFacade.getInstance().getVmStaticDAO().getAllByStoragePoolId(getStoragePool().getId()); if (vms.size() > 0) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_VMS); return false; } } return true; }

Target:
protected boolean canDoAction() { boolean returnValue = super.canDoAction() && checkStoragePool() && CheckStoragePoolStatusNotEqual(StoragePoolStatus.Up, VdcBllMessages.ERROR_CANNOT_REMOVE_ACTIVE_STORAGE_POOL); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__STORAGE__POOL); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); if (!returnValue) { return false; } if (getStoragePool().getstatus() != StoragePoolStatus.Uninitialized && !getParameters().getForceDelete() && !InitializeVds()) { return false; } final List<storage_domains> poolDomains = DbFacade.getInstance().getStorageDomainDAO().getAllForStoragePool( getStoragePool().getId()); final List<storage_domains> activeOrLockedDomains = getActiveOrLockedDomainList(poolDomains); if (!activeOrLockedDomains.isEmpty()) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_POOL_WITH_ACTIVE_DOMAINS); return false; } if (!getParameters().getForceDelete()) { if(poolDomains.size() > 1) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_NONMASTER_DOMAINS); return false; } for (storage_domains domain : poolDomains) { if ((domain.getstorage_domain_type() == StorageDomainType.Data || domain.getstorage_domain_type() == StorageDomainType.Master) && DbFacade.getInstance() .getDiskImageDAO() .getAllSnapshotsForStorageDomain(domain.getId()) .size() != 0) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_IMAGES); return false; } } final List<VmStatic> vms = DbFacade.getInstance().getVmStaticDAO().getAllByStoragePoolId(getStoragePool().getId()); if (vms.size() > 0) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_VMS); return false; } } return true; }