CLOUDSTACK-6676: cleanup ip address details on ip disassoc

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/57e66dda
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/57e66dda
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/57e66dda

Branch: refs/heads/master
Commit: 57e66ddaa65c7a36883c1ecc4e012716c38e9a62
Parents: 2ed9b47
Author: Alena Prokharchyk <alena.prokharc...@citrix.com>
Authored: Thu Jun 5 17:26:01 2014 -0700
Committer: Alena Prokharchyk <alena.prokharc...@citrix.com>
Committed: Thu Jun 5 17:36:32 2014 -0700

----------------------------------------------------------------------
 engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57e66dda/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java 
b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
index b569718..e1530ca 100755
--- a/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
@@ -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);
     }
 

Reply via email to