From a5dcb2754707f928318e5aaba52f8aee34a56c4a Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Fri, 19 Jul 2013 18:28:09 +0530 Subject: [PATCH] CLOUDSTACK-3640: [Usage][GSLB] usage events are not generated for GSLB geneating usage events for create/delete of GSLB rule --- .../gslb/GlobalLoadBalancingRulesServiceImpl.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java index 38ba37cd199..0ba09c14a1e 100644 --- a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java +++ b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java @@ -24,6 +24,7 @@ import com.cloud.configuration.Config; import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.event.ActionEvent; import com.cloud.event.EventTypes; +import com.cloud.event.UsageEventUtils; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Network; @@ -140,6 +141,11 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR stickyMethod, serviceType, regionId, gslbOwner.getId(), gslbOwner.getDomainId(), GlobalLoadBalancerRule.State.Staged); _gslbRuleDao.persist(newGslbRule); + + UsageEventUtils.publishUsageEvent(EventTypes.EVENT_GLOBAL_LOAD_BALANCER_CREATE, newGslbRule.getAccountId(), + 0, newGslbRule.getId(), name, GlobalLoadBalancerRule.class.getName(), + newGslbRule.getUuid()); + txn.commit(); s_logger.debug("successfully created new global load balancer rule for the account " + gslbOwner.getId()); @@ -438,6 +444,9 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR s_logger.debug("Rule Id: " + gslbRuleId + " is still in Staged state so just removing it."); } _gslbRuleDao.remove(gslbRuleId); + UsageEventUtils.publishUsageEvent(EventTypes.EVENT_GLOBAL_LOAD_BALANCER_DELETE, gslbRule.getAccountId(), + 0, gslbRule.getId(), gslbRule.getName(), GlobalLoadBalancerRule.class.getName(), + gslbRule.getUuid()); return; } else if (gslbRule.getState() == GlobalLoadBalancerRule.State.Add || gslbRule.getState() == GlobalLoadBalancerRule.State.Active) { //mark the GSlb rule to be in revoke state @@ -480,6 +489,10 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR //remove the GSLB rule itself _gslbRuleDao.remove(gslbRuleId); + UsageEventUtils.publishUsageEvent(EventTypes.EVENT_GLOBAL_LOAD_BALANCER_DELETE, gslbRule.getAccountId(), + 0, gslbRule.getId(), gslbRule.getName(), GlobalLoadBalancerRule.class.getName(), + gslbRule.getUuid()); + txn.commit(); }