[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-6579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13990339#comment-13990339
 ] 

Koushik Das commented on CLOUDSTACK-6579:
-----------------------------------------

The dashboard in CS UI is impacted by this.
For now I will fix it by correctly passing the required values. Also will fix 
the simulator as well.

diff --git 
a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java
 
b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultHostLis
index fffd1e8..e77d548 100644
--- 
a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java
+++ 
b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java
@@ -81,7 +81,7 @@ public class DefaultHostListener implements 
HypervisorHostListener {
         }
 
         StoragePoolVO poolVO = this.primaryStoreDao.findById(poolId);
-        poolVO.setUsedBytes(mspAnswer.getPoolInfo().getAvailableBytes());
+        poolVO.setUsedBytes(mspAnswer.getPoolInfo().getCapacityBytes() - 
mspAnswer.getPoolInfo().getAvailableBytes());
         poolVO.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes());
         primaryStoreDao.update(pool.getId(), poolVO);
 
diff --git 
a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java
 
b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java
index 69d4bac..8e1aaed 100644
--- 
a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java
+++ 
b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java
@@ -362,7 +362,7 @@ public class MockStorageManagerImpl extends ManagerBase 
implements MockStorageMa
             txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
             txn.close();
         }
-        return new ModifyStoragePoolAnswer(cmd, storagePool.getCapacity(), 0, 
new HashMap<String, TemplateProp>());
+        return new ModifyStoragePoolAnswer(cmd, storagePool.getCapacity(), 
storagePool.getCapacity(), new HashMap<String, TemplateProp>());
     }
 
     @Override
@@ -964,7 +964,7 @@ public class MockStorageManagerImpl extends ManagerBase 
implements MockStorageMa
             }
         }
         return new StoragePoolInfo(storagePool.getUuid(), 
host.getPrivateIpAddress(), storagePool.getMountPoint(), 
storagePool.getMountPoint(),
-            storagePool.getPoolType(), storagePool.getCapacity(), 0);
+            storagePool.getPoolType(), storagePool.getCapacity(), 
storagePool.getCapacity());
     }
 
     @Override




> used_bytes column of storage_pool table is no longer used and should be 
> removed
> -------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-6579
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-6579
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Management Server
>    Affects Versions: 4.4.0
>            Reporter: Mike Tutkowski
>             Fix For: 4.5.0
>
>
> From an e-mail discussion on the mailing list:
> Ideally, we should deprecate the column since its not used and causes
> confusion.
> Setting to this value wouldn't help because this column is never updated
> regularly.
> On 05/05/14 10:28 AM, "Mike Tutkowski" <[email protected]>
> wrote:
> >How's about I just check this code into master?
> >
> >poolVO.setUsedBytes(mspAnswer.getPoolInfo().getCapacityBytes() -
> >mspAnswer.getPoolInfo().getAvailableBytes());
> >
> >It is patterned off of the PrimaryDataStoreHelper.attachHost logic, which
> >looks like this:
> >
> >pool.setUsedBytes(existingInfo.getCapacityBytes() -
> >existingInfo.getAvailableBytes());
> >
> >
> >On Mon, May 5, 2014 at 10:21 AM, Nitin Mehta <[email protected]>
> >wrote:
> >
> >> This column is not used for calculating capacity for pool.
> >> We have always used op host capacity table. Nevertheless please do file
> >>a
> >> bug
> >>
> >> Thanks,
> >> -Nitin
> >> ________________________________________
> >> From: Mike Tutkowski [[email protected]]
> >> Sent: Monday, May 05, 2014 9:12 PM
> >> To: [email protected]
> >> Subject: Re: How is this working?
> >>
> >> My storage plug-in actually uses a custom host listener, so I have not
> >> encountered this issue.
> >>
> >> I don't remember off hand if it was in 4.2 or 4.3, but at some point
> >> someone changed the storage_pool table's available_bytes column to be
> >> used_bytes.
> >>
> >> It looks like this code you reference was missed.
> >>
> >>
> >> On Mon, May 5, 2014 at 4:35 AM, Koushik Das <[email protected]>
> >> wrote:
> >>
> >> > I came across this code snippet in hostConnect() method in
> >> > DefaultHostListener.java. Look at the line where the used bytes is
> >>set on
> >> > the poolVO. This looks like a serious bug. Looking at the history this
> >> code
> >> > has been there since a year. Has anyone encountered any issues with
> >> primary
> >> > storage capacity?
> >> >
> >> > ModifyStoragePoolAnswer mspAnswer = (ModifyStoragePoolAnswer)answer;
> >> > Š..
> >> > StoragePoolVO poolVO = this.primaryStoreDao.findById(poolId);
> >> > poolVO.setUsedBytes(mspAnswer.getPoolInfo().getAvailableBytes());
> >> > poolVO.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes());
> >> > primaryStoreDao.update(pool.getId(), poolVO);
> >> >
> >> >
> >> > -Koushik



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to