GitHub user sudhansu7 opened a pull request:

    https://github.com/apache/cloudstack/pull/1844

    CLOUDSTACK-9668 : disksizeallocated of PrimaryStorage is different fr…

    …om the total size of a volume
    
    update capacity if current allocated is different from used bytes in DB.
    
    
    
    Disksizeallocated of PrimaryStorage is different from the total size of a 
volume.
    
    steps to reproduce:
    1. create another primary storage( apart from default) with storage tag 
(say tag1)
    2. create a disk offering with storage tag as that step1.
    3. create a data disk with above disk offering.
    4. attach the disk to vm.
    5. when capacity checker thread runs it will update the used_capacity. Note 
down the op_host_capacity details for pool created in step1.
    6. detach the disk and destroy the volume.
    7. when capacity checker thread runs it will not update the used_capacity 
to 0.
    
    Root Cause: If all volumes have been removed from storage_pool then 
capacity checker does not update the op_host_capacity.
    Resolution: Update capacity if current allocated is different from used 
bytes in DB.
    
    ```
    
    public void createCapacityEntry(StoragePoolVO storagePool, short 
capacityType, long allocated) {
    ..
    ..
    ..
    
    } else {
                CapacityVO capacity = capacities.get(0);
                if (capacity.getTotalCapacity() != totalOverProvCapacity || 
**allocated != 0L** || capacity.getCapacityState() != capacityState) { 
                   ....
    ......
                }
            }
    
    ..
    .
    ```
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9668

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/1844.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1844
    
----
commit a8ba7c47787afa660327edca5604b1a82ab70aa8
Author: Sudhansu <sudhansu.s...@accelerite.com>
Date:   2016-12-21T08:37:47Z

    CLOUDSTACK-9668 : disksizeallocated of PrimaryStorage is different from the 
total size of a volume
    
    update capacity if current allocated is different from used bytes in DB.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to