mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
bug 7929: remove security groups when account is deleted.
status 7929: resolved fixed
This commit is contained in:
parent
2e018d46be
commit
2b66b8a924
@ -27,5 +27,6 @@ public interface SecurityGroupDao extends GenericDao<SecurityGroupVO, Long> {
|
||||
List<SecurityGroupVO> listByAccountId(long accountId);
|
||||
boolean isNameInUse(Long accountId, Long domainId, String name);
|
||||
SecurityGroupVO findByAccountAndName(Long accountId, String name);
|
||||
List<SecurityGroupVO> findByAccountAndNames(Long accountId, String... names);
|
||||
List<SecurityGroupVO> findByAccountAndNames(Long accountId, String... names);
|
||||
int removeByAccountId(long accountId);
|
||||
}
|
||||
|
||||
@ -87,5 +87,11 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
||||
sc.setParameters("groupNames", (Object [])names);
|
||||
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int removeByAccountId(long accountId) {
|
||||
SearchCriteria sc = AccountIdSearch.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
return expunge(sc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,6 +78,7 @@ import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
||||
import com.cloud.network.security.SecurityGroupManager;
|
||||
import com.cloud.network.security.dao.SecurityGroupDao;
|
||||
import com.cloud.server.Criteria;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
@ -131,6 +132,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
||||
@Inject private VMTemplateDao _templateDao;
|
||||
@Inject private PodVlanMapDao _podVlanMapDao;
|
||||
@Inject private NetworkDao _networkDao;
|
||||
@Inject private SecurityGroupDao _securityGroupDao;
|
||||
|
||||
|
||||
@Inject private SecurityGroupManager _networkGroupMgr;
|
||||
@ -898,6 +900,8 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
||||
accountCleanupNeeded = true;
|
||||
}
|
||||
|
||||
int numRemoved = _securityGroupDao.removeByAccountId(accountId);
|
||||
s_logger.info("deleteAccount: Deleted " + numRemoved + " network groups for account " + accountId);
|
||||
|
||||
// Delete the account's VLANs
|
||||
List<VlanVO> accountVlans = _vlanDao.listVlansForAccountByType(null, accountId, VlanType.DirectAttached);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user