CLOUDSTACK-8078: [Automation] Deletion of Affinity Groups - 
CloudRuntimeException: No Event Pubish can be wrapped within DB Transaction!

Changes:
-     The event of deleteing an affinity group is published on the MessageBus 
so that IAM Service can listen and process the event, However the publish 
operation should not be handled within a DB transaction, since it may take 
longer and hold the DB transaction for long unnecessarily
-    Publish any events to MessageBus outside of the transaction

Conflicts:
        server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java


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

Branch: refs/heads/master
Commit: 01ae7120ac2d8a9c673ab5d54d45f604a4a88581
Parents: a7861aa
Author: Prachi Damle <prachi.da...@citrix.com>
Authored: Tue Dec 16 16:46:28 2014 -0800
Committer: Prachi Damle <prachi.da...@citrix.com>
Committed: Wed Dec 17 13:53:11 2014 -0800

----------------------------------------------------------------------
 .../apache/cloudstack/affinity/AffinityGroupServiceImpl.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01ae7120/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java 
b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
index 8e606ca..91835ea 100644
--- a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
+++ b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
@@ -298,13 +298,14 @@ public class AffinityGroupServiceImpl extends ManagerBase 
implements AffinityGro
                     if (groupDomain != null) {
                         _affinityGroupDomainMapDao.remove(groupDomain.getId());
                     }
-                    // remove its related ACL permission
-                    Pair<Class<?>, Long> params = new Pair<Class<?>, 
Long>(AffinityGroup.class, affinityGroupIdFinal);
-                    _messageBus.publish(_name, 
EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params);
                 }
             }
         });
 
+        // remove its related ACL permission
+        Pair<Class<?>, Long> params = new Pair<Class<?>, 
Long>(AffinityGroup.class, affinityGroupIdFinal);
+        _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, 
PublishScope.LOCAL, params);
+
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Deleted affinity group id=" + affinityGroupId);
         }

Reply via email to