You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/09/01 05:25:00 UTC

[GitHub] [cloudstack] Pearl1594 commented on pull request #5259: usage: create backup usage record for vmId-offeringId pair

Pearl1594 commented on pull request #5259:
URL: https://github.com/apache/cloudstack/pull/5259#issuecomment-909901632


   @weizhouapache cc @nvazquez @rhtyd While the new approach fixes the problem; it solves the issue the same way #5005 attempted to and we did have reservations with the approach as it changes the behavior i.e., the columns `usage_display` and `raw_usage` which initially stored the size of the backup, now would show the duration over which the backup offering is assigned to the VM - Please note the comments at the right of the table below - Could this lead to some ambiguity ; I am for representing the usage records in the way the PR does, but do we need to have some upgrade path in place to change already recorded values which have `usage_display` and` raw_usage` in GB?
   
   That said, as of fixing the issue - the solution LGTM
   ```
   select id, raw_usage, usage_display, vm_instance_id, offering_id, usage_id, start_date, end_date, virtual_size, size from cloud_usage where vm_instance_id = 3 and usage_type = 28;
   
   +-------+----------------------+---------------+----------------+-------------+----------+---------------------+---------------------+--------------+------+  
   | 18350 |                 1000 | 0.0000 GiB    |              3 |           1 |        3 | 2021-09-01 04:32:00 | 2021-09-01 04:33:00 |          100 | 1000 | <-- When old usage job was running
   | 18365 |                 1000 | 0.0000 GiB    |              3 |           1 |        3 | 2021-09-01 04:33:00 | 2021-09-01 04:34:00 |          100 | 1000 |
   | 18380 | 0.017889168113470078 | 0.017889 Hrs  |              3 |           1 |        3 | 2021-09-01 04:34:00 | 2021-09-01 04:35:04 |          100 | 1000 | <-- After the new code changes kicked in
   | 18395 |  0.01666666753590107 | 0.016667 Hrs  |              3 |           1 |        3 | 2021-09-01 04:35:04 | 2021-09-01 04:36:04 |          100 | 1000 |
   | 18410 |  0.01666666753590107 | 0.016667 Hrs  |              3 |           1 |        3 | 2021-09-01 04:36:04 | 2021-09-01 04:37:04 |          100 | 1000 |
   ....
   | 18594 | 0.016668887808918953 | 0.016669 Hrs  |              3 |           1 |        3 | 2021-09-01 04:48:04 | 2021-09-01 04:49:04 |          100 | 1000 |
   | 18609 | 0.004332222044467926 | 0.004332 Hrs  |              3 |           1 |        3 | 2021-09-01 04:49:04 | 2021-09-01 04:50:04 |          100 | 1000 | <-- VM unassigned from bkp offering
   | 18737 | 0.014833054505288601 | 0.014833 Hrs  |              3 |           1 |        3 | 2021-09-01 04:58:04 | 2021-09-01 04:59:04 |          100 | 1000 | <-- VM re-assinged to the same bkp offering
   | 18752 | 0.016666390001773834 | 0.016666 Hrs  |              3 |           1 |        3 | 2021-09-01 04:59:04 | 2021-09-01 05:00:04 |          100 | 1000 |
   ....
   | 18951 |  0.013779444620013237 | 0.013779 Hrs  |              3 |           1 |        3 | 2021-09-01 05:12:04 | 2021-09-01 05:13:04 |          100 | 1000 |
   | 18952 | 0.0017772221472114325 | 0.001777 Hrs  |              3 |           2 |        3 | 2021-09-01 05:12:04 | 2021-09-01 05:13:04 |            0 |    0 | <-- VM assigned to new bkp offering (ID:2)
   | 18967 |  0.016665834933519363 | 0.016666 Hrs  |              3 |           2 |        3 | 2021-09-01 05:13:04 | 2021-09-01 05:14:04 |          100 | 1000 |
   +-------+-----------------------+---------------+----------------+-------------+----------+---------------------+---------------------+--------------+------+
   ```


-- 
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