Fix inconsistencies that result in Usage generating usage records when it should not #9888
+21
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes some inconsistencies which results in Usage generating usage records when it should not, namely:
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
Duplicated usage record generation for networks
Allocated
Before the changes, after the Usage job finishes, there would be two non-removed helper entries for the same network, resulting in duplicated usage records being generated for the network. After the changes, the first helper entry was marked as removed.
Removed port forwarding rules generating usage records
cloud_usage.usage_port_forwarding
, that the helper entry had an ID different from the PF rule's IDBefore the changes, the helper entry would not get marked as removed in step 5, resulting in usage records still being generated for the removed PF rule. After the changes, the helper entry got marked as removed.
Removed load balancer policies generating usage records
cloud_usage.usage_load_balancer_policy
, that the helper entry had an ID different from the LB policy's IDBefore the changes, the helper entry would not get marked as removed in step 5, resulting in usage records still being generated for the removed LB policy. After the changes, the helper entry got marked as removed.
Removed VM snapshots generating usage records
cloud_usage.usage_snapshot_on_primary
, that the helper entry had IDs different from the VM's IDBefore the changes, the helper entries would not get marked as removed in step 5, resulting in usage records still being generated for the removed VM snapshots. After the changes, the helper entries got marked as removed.
Volumes in the secondary storage that were attached still generate usage records
cloud_usage.usage_storage
, that the helper entry had had an ID different from the volume's IDBefore the changes, a helper entry would be created to generate secondary storage usage records for the volume (in
cloud_usage.usage_storage
). After attaching, another entry would be created to generate primary storage volume usage records; however, the secondary storage helper entry did not get removed, resulting in secondary storage usage records being generated for a volume that was not in the secondary storage anymore.After the changes, the secondary storage helper entry was marked as removed.