You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2014/11/11 13:03:48 UTC

[09/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

CLOUDSTACK-7859: Host tags are not getting removed in cloud.host_tags table when a Host is deleted from CS.


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

Branch: refs/heads/statscollector-graphite
Commit: 1c9775b0dfb03707279318408037845fa7a81873
Parents: 17e8d9e
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Fri Nov 7 16:55:50 2014 +0530
Committer: Sanjay Tripathi <sa...@citrix.com>
Committed: Fri Nov 7 17:34:16 2014 +0530

----------------------------------------------------------------------
 engine/schema/src/com/cloud/host/dao/HostTagsDao.java     |  2 ++
 engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java | 10 ++++++++++
 server/src/com/cloud/resource/ResourceManagerImpl.java    |  7 +++++--
 3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c9775b0/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostTagsDao.java b/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
index 8901716..c811de9 100644
--- a/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
+++ b/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
@@ -29,4 +29,6 @@ public interface HostTagsDao extends GenericDao<HostTagVO, Long> {
 
     List<String> getDistinctImplicitHostTags(List<Long> hostIds, String[] implicitHostTags);
 
+    void deleteTags(long hostId);
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c9775b0/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
index 7e8615a..e275e04 100644
--- a/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
+++ b/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
@@ -72,6 +72,16 @@ public class HostTagsDaoImpl extends GenericDaoBase<HostTagVO, Long> implements
     }
 
     @Override
+    public void deleteTags(long hostId) {
+        TransactionLegacy txn = TransactionLegacy.currentTxn();
+        txn.start();
+        SearchCriteria<HostTagVO> sc = HostSearch.create();
+        sc.setParameters("hostId", hostId);
+        expunge(sc);
+        txn.commit();
+    }
+
+    @Override
     public void persist(long hostId, List<String> hostTags) {
         TransactionLegacy txn = TransactionLegacy.currentTxn();
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c9775b0/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index fcc4ddb..77f6041 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -847,8 +847,11 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
         // delete host details
         _hostDetailsDao.deleteDetails(hostId);
 
-                // if host is GPU enabled, delete GPU entries
-                _hostGpuGroupsDao.deleteGpuEntries(hostId);
+        // if host is GPU enabled, delete GPU entries
+        _hostGpuGroupsDao.deleteGpuEntries(hostId);
+
+        // delete host tags
+        _hostTagsDao.deleteTags(hostId);
 
         host.setGuid(null);
         Long clusterId = host.getClusterId();