You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "SURYAS1306 (via GitHub)" <gi...@apache.org> on 2026/02/06 20:45:43 UTC

[PR] Fix duplicate RUNNING_VM helper record creation on repeated VM.START events [cloudstack]

SURYAS1306 opened a new pull request, #12606:
URL: https://github.com/apache/cloudstack/pull/12606

   ### 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.
   
   ### 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
   
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [x] Test (unit or integration test code)
   
   ### Bug Severity
   
   - [x] Minor
   
   ### How Has This Been Tested?
   
   - Added a unit test in `UsageManagerImplTest` to verify that duplicate
     `RUNNING_VM` helper records are not created when repeated `VM.START`
     events are handled.
   - Built and tested the `cloud-usage` module successfully using Maven.
   
   #### How did you try to break this feature and the system with this change?
   
   - Simulated repeated `VM.START` events for the same VM instance to ensure
     that helper record creation is skipped when an active `RUNNING_VM`
     record already exists.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix duplicate RUNNING_VM helper record creation on repeated VM.START events [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #12606:
URL: https://github.com/apache/cloudstack/pull/12606#issuecomment-5492909067

   @abh1sar @SURYAS1306 this seem a duplicate to #13019 which is merged. closing this but please re-open if in err


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix duplicate RUNNING_VM helper record creation on repeated VM.START events [cloudstack]

Posted by "SURYAS1306 (via GitHub)" <gi...@apache.org>.
SURYAS1306 commented on PR #12606:
URL: https://github.com/apache/cloudstack/pull/12606#issuecomment-3872623448

   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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix duplicate RUNNING_VM helper record creation on repeated VM.START events [cloudstack]

Posted by "abh1sar (via GitHub)" <gi...@apache.org>.
abh1sar commented on PR #12606:
URL: https://github.com/apache/cloudstack/pull/12606#issuecomment-3881561604

   > 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.
   
   Thanks, can you turn the PR into Draft until then?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix duplicate RUNNING_VM helper record creation on repeated VM.START events [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12606:
URL: https://github.com/apache/cloudstack/pull/12606#issuecomment-4824190195

   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix duplicate RUNNING_VM helper record creation on repeated VM.START events [cloudstack]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #12606:
URL: https://github.com/apache/cloudstack/pull/12606#issuecomment-3862482518

   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)
   Here are some useful points:
   - In case of a new feature add useful documentation (raise doc PR at https://github.com/apache/cloudstack-documentation)
   - Be patient and persistent. It might take some time to get a review or get the final approval from the committers.
   - Pay attention to the quality of your code, ensure tests are passing and your PR doesn't have conflicts.
   - Please follow [ASF Code of Conduct](https://github.com/apache/.github/blob/main/.github/CODE_OF_CONDUCT.md) for all communication including (but not limited to) comments on Pull Requests, Issues, Mailing list and Slack.
   - Be sure to read the [CloudStack Coding Conventions](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventions).
   Apache CloudStack is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@cloudstack.apache.org (https://cloudstack.apache.org/mailing-lists.html)
   Slack: https://apachecloudstack.slack.com/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix duplicate RUNNING_VM helper record creation on repeated VM.START events [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #12606:
URL: https://github.com/apache/cloudstack/pull/12606#issuecomment-3870109247

   Thank you @SURYAS1306 , can you rebase this on the 4.20 branch?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix duplicate RUNNING_VM helper record creation on repeated VM.START events [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland closed pull request #12606: Fix duplicate RUNNING_VM helper record creation on repeated VM.START events
URL: https://github.com/apache/cloudstack/pull/12606


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org