CLOUDSTACK-6676: cleanup ip address details on ip disassoc

This commit is contained in:
Alena Prokharchyk 2014-06-05 17:26:01 -07:00
parent 2ed9b474d8
commit 57e66ddaa6
1 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import javax.annotation.PostConstruct;
import javax.ejb.Local;
import javax.inject.Inject;
import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@ -63,6 +64,8 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
protected GenericSearchBuilder<IPAddressVO, Long> CountFreePublicIps;
@Inject
ResourceTagDao _tagsDao;
@Inject
UserIpAddressDetailsDao _detailsDao;
// make it public for JUnit test
public IPAddressDaoImpl() {
@ -166,6 +169,8 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
address.setSystem(false);
address.setVmIp(null);
address.setDisplay(true);
//remove resource details for the ip
_detailsDao.removeDetails(ipAddressId);
update(ipAddressId, address);
}