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

   ### Description
   
   Currently, the quota plugin ignores the tariff calculation for the types 
below:
   
   * VM_DISK_IO_READ
   * VM_DISK_IO_WRITE
   * VM_DISK_BYTES_READ
   * VM_DISK_BYTES_WRITE
   
   The code was changed as to now calculate the quota tariff for these types. 
Moreover, the unit types were changed as well, as shown in the table below. It 
is noteworthy that the raw values for these types are not modified; therefore, 
the calculation of the tariff for them are: `TARIFF * CONSUMPTION`.
   
   | Type | Unit |
   | ------ | ------ |
   | VM_DISK_IO_READ | IOPS |
   | VM_DISK_IO_WRITE | IOPS |
   | VM_DISK_BYTES_READ | Bytes |
   | VM_DISK_BYTES_WRITE | Bytes |
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [x] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [x] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [x] Minor
   - [ ] Trivial
   
   
   ### Screenshots (if appropriate):
   
   
   ### How Has This Been Tested?
   
   This was tested in a local lab creating a quota tariff for each type. Then, 
I reinstalled a previously created VM and generated a quota statement.
   
   Creating a quota tariff with type `VM_DISK_IO_READ`:
   ~~~
   (lab-bryan) 🐱 > quota tariffcreate name=mr-443-21 usagetype=21 value=30
   {
     "quotatariff": {
       "currency": "$",
       "effectiveDate": "2023-01-24T15:39:39+0000",
       "name": "mr-443-21",
       "tariffValue": 30,
       "usageDiscriminator": "None",
       "usageName": "VM_DISK_IO_READ",
       "usageType": 21,
       "usageTypeDescription": "VM Disk usage(I/O Read)",
       "usageUnit": "IOPS",
       "uuid": "e580d696-5e5e-4423-87e5-130298a2cb0f"
     }
   }
   ~~~
   
   ~~~
   (lab) 🐱 > quota statement accountid=af16aaed-26de-11ec-8dcf-5254005dcdac 
account=admin domainid=52d83793-26de-11ec-8dcf-5254005dcdac 
startdate=2023-01-23 enddate=2023-01-25
   {
     "statement": {
       "currency": "$",
       "enddate": "2023-01-25T23:59:59+0000",
       "quotausage": [
         (...)
         {
           "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
           "domain": "52d83793-26de-11ec-8dcf-5254005dcdac",
           "name": "VM_DISK_IO_READ",
           "quota": 771439.82,
           "type": 21,
           "unit": "IOPS"
         },
         {
           "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
           "domain": "52d83793-26de-11ec-8dcf-5254005dcdac",
           "name": "VM_DISK_IO_WRITE",
           "quota": 0.44,
           "type": 22,
           "unit": "IOPS"
         },
         {
           "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
           "domain": "52d83793-26de-11ec-8dcf-5254005dcdac",
           "name": "VM_DISK_BYTES_READ",
           "quota": 12667348.48,
           "type": 23,
           "unit": "Bytes"
         },
         {
           "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
           "domain": "52d83793-26de-11ec-8dcf-5254005dcdac",
           "name": "VM_DISK_BYTES_WRITE",
           "quota": 2929711.64,
           "type": 24,
           "unit": "Bytes"
         }
         (...)
       ],
       "startdate": "2023-01-23T00:00:00+0000",
       "totalquota": 16368503.29
     }
   }
   ~~~
   


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