Skip to content

Commit a5dcb27

Browse files
committed
CLOUDSTACK-3640: [Usage][GSLB] usage events are not generated for GSLB
geneating usage events for create/delete of GSLB rule
1 parent 28aaa75 commit a5dcb27

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.cloud.configuration.dao.ConfigurationDao;
2525
import com.cloud.event.ActionEvent;
2626
import com.cloud.event.EventTypes;
27+
import com.cloud.event.UsageEventUtils;
2728
import com.cloud.exception.InvalidParameterValueException;
2829
import com.cloud.exception.ResourceUnavailableException;
2930
import com.cloud.network.Network;
@@ -140,6 +141,11 @@ public GlobalLoadBalancerRule createGlobalLoadBalancerRule(CreateGlobalLoadBalan
140141
stickyMethod, serviceType, regionId, gslbOwner.getId(), gslbOwner.getDomainId(),
141142
GlobalLoadBalancerRule.State.Staged);
142143
_gslbRuleDao.persist(newGslbRule);
144+
145+
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_GLOBAL_LOAD_BALANCER_CREATE, newGslbRule.getAccountId(),
146+
0, newGslbRule.getId(), name, GlobalLoadBalancerRule.class.getName(),
147+
newGslbRule.getUuid());
148+
143149
txn.commit();
144150

145151
s_logger.debug("successfully created new global load balancer rule for the account " + gslbOwner.getId());
@@ -438,6 +444,9 @@ private void revokeGslbRule(long gslbRuleId, Account caller) {
438444
s_logger.debug("Rule Id: " + gslbRuleId + " is still in Staged state so just removing it.");
439445
}
440446
_gslbRuleDao.remove(gslbRuleId);
447+
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_GLOBAL_LOAD_BALANCER_DELETE, gslbRule.getAccountId(),
448+
0, gslbRule.getId(), gslbRule.getName(), GlobalLoadBalancerRule.class.getName(),
449+
gslbRule.getUuid());
441450
return;
442451
} else if (gslbRule.getState() == GlobalLoadBalancerRule.State.Add || gslbRule.getState() == GlobalLoadBalancerRule.State.Active) {
443452
//mark the GSlb rule to be in revoke state
@@ -480,6 +489,10 @@ private void revokeGslbRule(long gslbRuleId, Account caller) {
480489
//remove the GSLB rule itself
481490
_gslbRuleDao.remove(gslbRuleId);
482491

492+
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_GLOBAL_LOAD_BALANCER_DELETE, gslbRule.getAccountId(),
493+
0, gslbRule.getId(), gslbRule.getName(), GlobalLoadBalancerRule.class.getName(),
494+
gslbRule.getUuid());
495+
483496
txn.commit();
484497
}
485498

0 commit comments

Comments
 (0)