weizhouapache opened a new issue #5662:
URL: https://github.com/apache/cloudstack/issues/5662


   When list usagerecords with type=25 (vm snapshot), got duplicated usage 
record
   
   ```
       {
         "description": "VMSnapshot usage Id: 34 
(ce4674f1-056c-4035-b3fb-ff80dd396428)  for VM xxxx 
(18eccc8e-b0d7-4c15-af88-e2cac4f37a41)",
         "domain": "ROOT",
         "domainid": "98bb987b-5982-11eb-8965-005056bd251c",
         "enddate": "2021-11-01'T'23:59:59+00:00",
         "name": "4.15",
         "projectid": "a7b86f56-eb27-40ee-8791-96efa8f74470",
         "rawusage": "13.330832",
         "size": 2097217494,
         "startdate": "2021-11-01'T'10:40:09+00:00",
         "tags": [],
         "usage": "13.330832 Hrs",
         "usageid": "ce4674f1-056c-4035-b3fb-ff80dd396428",
         "usagetype": 25,
         "virtualmachineid": "18eccc8e-b0d7-4c15-af88-e2cac4f37a41",
         "zoneid": "3350ba2e-3437-489a-a8f9-66b1282c899d"
       },
       {
         "description": "VMSnapshot usage Id: 34 
(ce4674f1-056c-4035-b3fb-ff80dd396428)  for VM xxxx 
(18eccc8e-b0d7-4c15-af88-e2cac4f37a41)",
         "domain": "ROOT",
         "domainid": "98bb987b-5982-11eb-8965-005056bd251c",
         "enddate": "2021-11-01'T'23:59:59+00:00",
         "name": "4.15",
         "projectid": "a7b86f56-eb27-40ee-8791-96efa8f74470",
         "rawusage": "13.330832",
         "size": 2097217494,
         "startdate": "2021-11-01'T'10:40:09+00:00",
         "tags": [],
         "usage": "13.330832 Hrs",
         "usageid": "ce4674f1-056c-4035-b3fb-ff80dd396428",
         "usagetype": 25,
         "virtualmachineid": "18eccc8e-b0d7-4c15-af88-e2cac4f37a41",
         "zoneid": "3350ba2e-3437-489a-a8f9-66b1282c899d"
       }
   
   ```
   
   in /var/log/cloudstack/usage/usage.log, it also shows usage records are 
created twice.
   
   ```
   # grep "Creating VMSnapshot" /var/log/cloudstack/usage/usage.log
   ...
   2021-11-02 23:12:50,603 DEBUG [usage.parser.VMSnapshotUsageParser] 
(Usage-Job-1:null) (logid:) Creating VMSnapshot Id:33 Volume usage record for 
vol: 18916, usage: 15.876111, startDate: Mon Nov 01 08:07:26 GMT 2021, endDate: 
Mon Nov 01 23:59:59 GMT 2021, for account: 4718
   2021-11-02 23:12:50,613 DEBUG [usage.parser.VMSnapshotUsageParser] 
(Usage-Job-1:null) (logid:) Creating VMSnapshot Id:33 Volume usage record for 
vol: 18916, usage: 15.876111, startDate: Mon Nov 01 08:07:26 GMT 2021, endDate: 
Mon Nov 01 23:59:59 GMT 2021, for account: 4718
   2021-11-02 23:12:50,623 DEBUG [usage.parser.VMSanpshotOnPrimaryParser] 
(Usage-Job-1:null) (logid:) Creating VMSnapshot Id: 33 On Primary usage record 
for vm: 18800, usage: 15.876111, startDate: Mon Nov 01 08:07:26 GMT 2021, 
endDate: Mon Nov 01 23:59:59 GMT 2021, for account: 4718
   2021-11-02 23:12:50,817 DEBUG [usage.parser.VMSnapshotUsageParser] 
(Usage-Job-1:null) (logid:) Creating VMSnapshot Id:34 Volume usage record for 
vol: 18921, usage: 13.330832, startDate: Mon Nov 01 10:40:09 GMT 2021, endDate: 
Mon Nov 01 23:59:59 GMT 2021, for account: 4720
   2021-11-02 23:12:50,824 DEBUG [usage.parser.VMSnapshotUsageParser] 
(Usage-Job-1:null) (logid:) Creating VMSnapshot Id:34 Volume usage record for 
vol: 18921, usage: 13.330832, startDate: Mon Nov 01 10:40:09 GMT 2021, endDate: 
Mon Nov 01 23:59:59 GMT 2021, for account: 4720
   2021-11-02 23:12:50,830 DEBUG [usage.parser.VMSanpshotOnPrimaryParser] 
(Usage-Job-1:null) (logid:) Creating VMSnapshot Id: 34 On Primary usage record 
for vm: 18805, usage: 13.330832, startDate: Mon Nov 01 10:40:09 GMT 2021, 
endDate: Mon Nov 01 23:59:59 GMT 2021, for account: 4720
   ```
   
   ##### ISSUE TYPE
   <!-- Pick one below and delete the rest -->
    * Bug Report
   
   
   ##### COMPONENT NAME
   <!--
   Categorize the issue, e.g. API, VR, VPN, UI, etc.
   -->
   ~~~
   Usage
   ~~~
   
   ##### CLOUDSTACK VERSION
   <!--
   New line separated list of affected versions, commit ID for issues on main 
branch.
   -->
   
   ~~~
   4.14, same issue should exist in 4.16
   ~~~
   
   ##### CONFIGURATION
   <!--
   Information about the configuration if relevant, e.g. basic network, 
advanced networking, etc.  N/A otherwise
   -->
   N/A
   
   ##### OS / ENVIRONMENT
   <!--
   Information about the environment if relevant, N/A otherwise
   -->
   N/A
   
   ##### SUMMARY
   <!-- Explain the problem/feature briefly -->
   
   
   ##### STEPS TO REPRODUCE
   <!--
   For bugs, show exactly how to reproduce the problem, using a minimal 
test-case. Use Screenshots if accurate.
   
   For new features, show how the feature would be used.
   -->
   
   <!-- Paste example playbooks or commands between quotes below -->
   ~~~
   
   ~~~
   
   <!-- You can also paste gist.github.com links for larger files -->
   
   ##### EXPECTED RESULTS
   <!-- What did you expect to happen when running the steps above? -->
   
   ~~~
   
   ~~~
   
   ##### ACTUAL RESULTS
   <!-- What actually happened? -->
   
   <!-- Paste verbatim command output between quotes below -->
   ~~~
   
   ~~~
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to