Hi Mike,

I've had problems with GUI stats as well.  I tried to solve the issue by 
focusing on the kernel commands that are used to populate database entries the 
GUI relies on.

There seem to be three important commands:  GetStorageStatsCommand, 
StartupStorageCommand and ModifyStoragePoolCommand.  GetStorageStatsCommand is 
called on a regular basis, StartupStorageCommand is returned by a Hypervisor 
agent once when it connects to the management  server, and  
ModifyStoragePoolCommand  is called once when primary storage is configured.  
The commands have fields for capacity, used, and available.

Problems were that I found the term 'capacity' ambiguous, and that 
ModifyStroagePoolCommand seemed to take a different view on what 
'availableBytes' means.

For, 'capacity',  I went with an implementation that set 'capacity' to total 
storage device volume and 'available' to unallocated space.  E.g.

public static void GetCapacityForLocalPath(string localStoragePath, out long 
capacityBytes, out long availableBytes)
{
...
    System.IO.DriveInfo poolInfo = new System.IO.DriveInfo(fullPath);
    capacityBytes = poolInfo.TotalSize;
    availableBytes = poolInfo.AvailableFreeSpace;
...

'used' became the difference between the two, e.g. for GetStorageStatsCommand

object ansContent = new
{
    result = result,
    details = details,
    capacity = capacity,
    used = capacity - available
};
return ReturnCloudStackTypedJArray(ansContent, 
CloudStackTypes.GetStorageStatsAnswer);

StartupStorageCommand does not have a 'used'.  Instead it returns "available" 
and "capacity", e.g.

StoragePoolInfo pi = new StoragePoolInfo(
                        poolGuid.ToString(),
                        ipAddr,
                        localStoragePath,
                        localStoragePath,
                        StoragePoolType.Filesystem.ToString(),
                        capacity,
                        available);

However, I have a note on the ModifyStoragePoolCommand to double check the 
meaning of available.  E.g.

var poolInfo = new
{
    uuid = uuid,
    host = cmd.pool.host,
    localPath = cmd.pool.host,
    hostPath = cmd.localPath,
    poolType = cmd.pool.type,
    capacityBytes = capacityBytes,
    // TODO:  double check whether you need 'available' or 'used' bytes?
    availableBytes = availableBytes
};

What has your experience been with ModifyStoragePoolCommand?


Finally, if the agent reconnects with a different identifier, you end up two 
entries in the database.  One for the previous connect and one for the new 
connection.  This messes up your storage stats.


DL


From: Mike Tutkowski [mailto:mike.tutkow...@solidfire.com]
Sent: 14 August 2013 23:05
To: dev@cloudstack.apache.org
Cc: Donal Lafferty
Subject: Re: Disk Allocated Versus Disk Used

I wonder if Donal can answer this question?

On Fri, Jul 12, 2013 at 7:18 PM, Mike Tutkowski 
<mike.tutkow...@solidfire.com<mailto:mike.tutkow...@solidfire.com>> wrote:
In looking at my Xen boxes, disksizeused appears to equate to used space.

disksizeallocated, I presume, should equate to what Xen calls allocated space, 
but it does not seem to (ex. the GUI wasn't showing anything, but in XenCenter 
it says 8 GB allocated space for one of my hosts).

On Fri, Jul 12, 2013 at 7:13 PM, Mike Tutkowski 
<mike.tutkow...@solidfire.com<mailto:mike.tutkow...@solidfire.com>> wrote:
Hi,

I noticed in the 4.2 GUI under the details of Primary Storage that the Disk 
Allocated field always seems to be empty.

I changed the logic to display the disksizeused field (instead of the 
disksizeallocated field) and now it seems to work.

Can someone tell me what the difference is supposed to be between these two 
fields and if the change I made should be checked in (along with changing the 
name of this field from Disk Allocated to Disk Used)?

Thanks!

--
Mike Tutkowski
Senior CloudStack Developer, SolidFire Inc.
e: mike.tutkow...@solidfire.com<mailto:mike.tutkow...@solidfire.com>
o: 303.746.7302<tel:303.746.7302>
Advancing the way the world uses the 
cloud<http://solidfire.com/solution/overview/?video=play>(tm)



--
Mike Tutkowski
Senior CloudStack Developer, SolidFire Inc.
e: mike.tutkow...@solidfire.com<mailto:mike.tutkow...@solidfire.com>
o: 303.746.7302<tel:303.746.7302>
Advancing the way the world uses the 
cloud<http://solidfire.com/solution/overview/?video=play>(tm)



--
Mike Tutkowski
Senior CloudStack Developer, SolidFire Inc.
e: mike.tutkow...@solidfire.com<mailto:mike.tutkow...@solidfire.com>
o: 303.746.7302
Advancing the way the world uses the 
cloud<http://solidfire.com/solution/overview/?video=play>(tm)

Reply via email to