cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donal Lafferty <>
Subject RE: Disk Allocated Versus Disk Used
Date Thu, 15 Aug 2013 09:33:00 GMT
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",

StoragePoolInfo pi = new StoragePoolInfo(

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

var poolInfo = new
    uuid = uuid,
    host =,
    localPath =,
    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.


From: Mike Tutkowski []
Sent: 14 August 2013 23:05
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 <<>>
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 <<>>

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


Mike Tutkowski
Senior CloudStack Developer, SolidFire Inc.
o: 303.746.7302<tel:303.746.7302>
Advancing the way the world uses the cloud<>(tm)

Mike Tutkowski
Senior CloudStack Developer, SolidFire Inc.
o: 303.746.7302<tel:303.746.7302>
Advancing the way the world uses the cloud<>(tm)

Mike Tutkowski
Senior CloudStack Developer, SolidFire Inc.
o: 303.746.7302
Advancing the way the world uses the cloud<>(tm)

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message