kiranchavala opened a new issue, #8413:
URL: https://github.com/apache/cloudstack/issues/8413

   ISSUE TYPE
   
   Bug/Enhancement/Improvement request/
   
   COMPONENT NAME
   
   Component: UI/API/Usage
   
   CLOUDSTACK VERSION
   
   Cloudstack version 4.18
   
   SUMMARY
   
   Disk offering doesn't change when the resize operation is performed
   
   https://cloudstack.apache.org/api/apidocs-4.18/apis/resizeVolume.html
   
   Steps to reproduce the issue
   
   1. Create a data disk with offering 5gb ( Small disk offering)
   
   
![resizeg](https://github.com/apache/cloudstack/assets/1401014/7555cb48-c3d7-40aa-8df1-b7694d9436e8)
   
   
   
![resize1](https://github.com/apache/cloudstack/assets/1401014/00980ab6-f814-4283-842b-b78ba86625b4)
   
   
   2. Click on the Resize 
   
   Navigate volume> select the disk and click on Resize option 
   
   
![resize2](https://github.com/apache/cloudstack/assets/1401014/043938da-15c7-4880-90aa-ecaa14c45963)
   
   or execute the resizeVolume api call 
   
   https://cloudstack.apache.org/api/apidocs-4.18/apis/resizeVolume.html
   
   
   3. Provide the new disk size let's say 10gb
   
   
![resize3](https://github.com/apache/cloudstack/assets/1401014/79291376-eef5-4043-8d6c-1c0bd2ab2524)
   
   
   
   4. Cloudstack resizes the data disk to 10gb, successfully but doesn't change 
the disk offering to custom disk offering
   
   
![resize](https://github.com/apache/cloudstack/assets/1401014/196f4173-6471-4594-b74a-1440b08e2b93)
   
   
   **Actual behavior**
   
   **According to docs**
   
   
http://docs.cloudstack.apache.org/en/4.18.1.0/adminguide/storage.html?highlight=disk%20resize#resizing-volumes
   
   Additionally, using the resizeVolume API, a data volume can be moved from a 
static disk offering to a custom disk offering with the size specified. This 
functionality allows those who might be billing by certain volume sizes or disk 
offerings to stick to that model, while providing the flexibility to migrate to 
whatever custom size is necessary.
   
   
   Even for the resizevolume api call is  disk offering id is not mandatory 
   
   https://cloudstack.apache.org/api/apidocs-4.18/apis/resizeVolume.html
   
   
   ---
   
   **Not changing the disk offering id could lead billing issue if the end user 
considers disk offering for billing** 
   
   
    
   If we take a look at the Database entries the offering id remains the same 
even after the resize is done, ideally it should change to a custom disk 
offering 
   
   Usage_event table
   
   The offering_id=3 is not  updated when a volume.resize is performed
   
   mysql> use cloud;
   
   ```
   mysql> select * from usage_event where resource_id=41 \G;
   *************************** 1. row ***************************
              id: 146
            type: VOLUME.CREATE
      account_id: 2
         created: 2023-12-28 05:19:12
         zone_id: 1
     resource_id: 41
   resource_name: ty
     offering_id: 3
     template_id: NULL
            size: 5368709120
   resource_type: NULL
       processed: 0
    virtual_size: NULL
   *************************** 2. row ***************************
              id: 147
            type: VOLUME.RESIZE
      account_id: 2
         created: 2023-12-28 05:19:29
         zone_id: 1
     resource_id: 41
   resource_name: ty
     offering_id: 3
     template_id: NULL
            size: 8589934592
   resource_type: NULL
       processed: 0
    virtual_size: NULL
   ```
    
    
   mysql> use cloud_usage;
   
   ```
   mysql>select * from cloud_usage where usage_type=6
   
   
                 id: 235
            zone_id: 1
         account_id: 2
          domain_id: 1
        description: Volume Id: 41 usage time (DiskOffering: 3)
      usage_display: 0.499999 Hrs
         usage_type: 6
          raw_usage: 0.49999913573265076
     vm_instance_id: NULL
            vm_name: NULL
        offering_id: 3
        template_id: NULL
           usage_id: 41
               type: NULL
               size: 8589934592
         network_id: NULL
         start_date: 2023-12-28 05:45:14
           end_date: 2023-12-28 06:15:14
       virtual_size: NULL
          cpu_speed: NULL
          cpu_cores: NULL
             memory: NULL
   quota_calculated: 0
          is_hidden: 0
   ```
   ```
    
   mysql> select * from usage_volume where volume_id=41 \G;
   *************************** 1. row ***************************
                 id: 29
          volume_id: 41
            zone_id: 1
         account_id: 2
          domain_id: 1
   disk_offering_id: 3
        template_id: NULL
               size: 5368709120
            created: 2023-12-28 05:19:12
            deleted: 2023-12-28 05:19:29
   *************************** 2. row ***************************
                 id: 30
          volume_id: 41
            zone_id: 1
         account_id: 2
          domain_id: 1
   disk_offering_id: 3
        template_id: NULL
               size: 8589934592
            created: 2023-12-28 05:19:29
            deleted: NULL
   2 rows in set (0.00 sec)
   ```
   
   
   **Expected behavior**
   
   
   Cloudstack should update the disk offering to custom disk offering in UI and 
the databases (Cloud and cloud_usag) 
   
   
   ```
   mysql> select * from disk_offering where id=6 \G;
   *************************** 1. row ***************************
                            id: 6
                          name: Custom
                          uuid: 9cc36337-08a4-4b00-9360-22353fa3503f
                  display_text: Custom Disk
                     disk_size: 0
                          tags: NULL
                   recreatable: 0
             use_local_storage: 0
                   unique_name: Cloud.Com-Custom
                    customized: 1
                       removed: NULL
                       created: 2023-12-26 11:01:13
                      sort_key: 0
              display_offering: 1
               customized_iops: NULL
                      min_iops: NULL
                      max_iops: NULL
               bytes_read_rate: NULL
           bytes_read_rate_max: NULL
    bytes_read_rate_max_length: NULL
              bytes_write_rate: NULL
          bytes_write_rate_max: NULL
   bytes_write_rate_max_length: NULL
                iops_read_rate: NULL
            iops_read_rate_max: NULL
     iops_read_rate_max_length: NULL
               iops_write_rate: NULL
           iops_write_rate_max: NULL
    iops_write_rate_max_length: NULL
                         state: Active
                 hv_ss_reserve: NULL
                    cache_mode: NULL
             provisioning_type: thin
          disk_size_strictness: 0
                  compute_only: 0
                       encrypt: 0
   ```
                        
   


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