| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
Sorry, something went wrong.
|
Thank you @SURYAS1306 , can you rebase this on the 4.20 branch? |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for working on this @SURYAS1306 .
But skipping insertion into the usage_vm_instance table is not the right approach.
| id | type | account_id | created | count | resource_id | name |
|---|---|---|---|---|---|---|
| 106 | VM.START | 6 | 2025-10-27 13:02:07 | 2 | 200 | fedora |
| 107 | VM.STOP | 6 | 2025-10-27 13:02:06 | 2 | 200 | fedora |
| 108 | VM.START | 6 | 2025-10-27 13:02:07 | 2 | 200 | fedora |
In the example above, if we skip the last event, it will cause usage to never register the Instance as started and it will not be billed properly.
Sorry, something went wrong.
|
Thanks for the review. That makes sense skipping the helper record creation could indeed cause the VM state to be inconsistent and affect billing. I'll revisit the approach and focus on handling duplicate VM.START events in a way that keeps the usage state correct (likely by making the processing idempotent rather than skipping the event). I'll rework the fix and update the PR. |
Sorry, something went wrong.
Thanks, can you turn the PR into Draft until then? |
Sorry, something went wrong.
|
This PR is stale because it has been open for 120 days with no activity. It may be removed by administrators of this project at any time. Remove the stale label or comment to request for removal of it to prevent this. |
Sorry, something went wrong.
|
@abh1sar @SURYAS1306 this seem a duplicate to #13019 which is merged. closing this but please re-open if in err |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
Repeated VM.START events for the same VM could result in duplicate
RUNNING_VM helper usage records being created in the usage database.
This PR adds a defensive check in UsageManagerImpl#createVMHelperEvent
to detect an existing active RUNNING_VM usage record (same VM instance,
endDate = NULL) and skip helper record creation when a duplicate START
event is received.
A regression test has been added to ensure that duplicate RUNNING_VM
helper records are not created when repeated VM.START events are
processed.
Fixes: #12590
Expected behavior
Only one active RUNNING_VM usage helper record should exist per VM at
any given time.
Actual behavior
Multiple RUNNING_VM helper records could be created for the same VM
when duplicate VM.START events were processed.
Types of changes
Bug Severity
How Has This Been Tested?
RUNNING_VM helper records are not created when repeated VM.START
events are handled.
How did you try to break this feature and the system with this change?
that helper record creation is skipped when an active RUNNING_VM
record already exists.