Description
Problem
When a Load Balancer Rule inside a VPC tier is deleted—either explicitly or as a result of disassociating the underlying Public IP—CloudStack logs the deletion event correctly in the event table (LB.CREATE and LB.DELETE). However, the deletion is not reflected in the cloud_usage.usage_load_balancer_policy table managed by the Cloud Usage service.
As a result, the delete_date field remains NULL, and Cloud Usage continues to generate usage records indefinitely for a resource that no longer exists. This causes inaccurate usage reporting and potentially incorrect billing.
Versions
• CloudStack version: Affected in versions > 4.18
• Hypervisor: KVM
• Network type: VPC with Tiers
Steps to Reproduce the Bug
1. Create a VPC with at least one tier.
2. Acquire a Public IP address and associate it with the tier.
3. Create a Load Balancer Rule using that Public IP.
4. Delete the Load Balancer Rule, or disassociate the Public IP from the tier.
5. Confirm that CloudStack logs the LB.DELETE event in the event table.
6. Wait for the Cloud Usage service to run and check the usage_load_balancer_policy table.
7. Observe that the delete_date remains NULL and usage records continue to be generated.
What to Do About It
• Investigate why the Cloud Usage service does not correctly register the LB.DELETE event into the usage_load_balancer_policy table.
• Review the logic that processes deletion events for Load Balancer policies in the Cloud Usage module.
• Patch the usage processor to ensure that deletions are properly handled and that the delete_date is updated.