php-opencloud / openstack

PHP SDK for OpenStack clouds
Apache License 2.0
223 stars 149 forks source link

getLimits() is missing the volume informations #80

Open ivpfals opened 8 years ago

ivpfals commented 8 years ago

Hi,

when using the computeV2()->getLimits() call to fetch the limits and quota informations for a given ProjectID, the data for volume usage is missing?

From the SDK call I get this:

OpenStack\Compute\v2\Models\Limit

Object ( [rate] => Array ( ) [absolute] => Array ( [maxServerMeta] => 1024 [maxPersonality] => -1 [totalServerGroupsUsed] => 0 [maxImageMeta] => 1024 [maxPersonalitySize] => 102400 [maxTotalKeypairs] => -1 [maxSecurityGroupRules] => 20 [maxServerGroups] => 10 [totalCoresUsed] => 1 [totalRAMUsed] => 2048 [totalInstancesUsed] => 1 [maxSecurityGroups] => 10 [totalFloatingIpsUsed] => 0 [maxTotalCores] => 20 [maxServerGroupMembers] => 10 [maxTotalFloatingIps] => 100 [totalSecurityGroupsUsed] => 1 [maxTotalInstances] => -1 [maxTotalRAMSize] => 81920 ) [resourceKey:protected] => limits [aliases:protected] => Array ( ) )

And when using the Openstack commandclient, I get this:

+--------------------------+--------+ | Name | Value | +--------------------------+--------+ | maxServerMeta | 1024 | | maxTotalInstances | -1 | | maxPersonality | -1 | | totalServerGroupsUsed | 0 | | maxImageMeta | 1024 | | maxPersonalitySize | 102400 | | maxTotalRAMSize | 81920 | | maxServerGroups | 10 | | maxSecurityGroupRules | 20 | | maxTotalKeypairs | -1 | | totalCoresUsed | 1 | | totalRAMUsed | 2048 | | maxSecurityGroups | 10 | | totalFloatingIpsUsed | 0 | | totalInstancesUsed | 1 | | maxServerGroupMembers | 10 | | maxTotalFloatingIps | 100 | | totalSecurityGroupsUsed | 1 | | maxTotalCores | 20 | | totalSnapshotsUsed | 0 | | maxTotalBackups | 10 | | maxTotalVolumeGigabytes | 2000 | | maxTotalSnapshots | -1 | | maxTotalBackupGigabytes | 1000 | | totalBackupGigabytesUsed | 0 | | maxTotalVolumes | -1 | | totalVolumesUsed | 0 | | totalBackupsUsed | 0 | | totalGigabytesUsed | 0 | +--------------------------+--------+

Is there any chance to get the missing data (totalVolumesUsed, totalGigabytesUsed etc.) via the SDK call?

haphan commented 8 years ago

@ivpfals AFAIK, such fields are only available if OpenStack instance has block storage service enabled see docs.

@jamiehannaford Any idea how to make model extensible and support this use case? I've looked in to rackspace/gophercloud but apparently this case is not also covered.

ivpfals commented 8 years ago

@haphan Well the cinder Services are enabled on our instance:

cinderv3 | TYPE: volumev3 | ID: 6378ba641ab848848b1bdc1d40c7a5d1 | DESCR: Cinder Service v3 cinder | TYPE: volume | ID: 65b1ceb385bd4988890a6fb8dc790bf9 | DESCR: Cinder Service

And the Openstack commandline tool queries the same instance, that's the reason why I'm asked :)

haphan commented 8 years ago

@ivpfals apologies for not being very clear. What I mean is cinder extension, when enabled, will modify the endpoint /v2/{tenantID}/limits and decorate the response with extra fields such as totalVolumesUsed, totalGigabytesUsed, etc.

The SDK at the moment, unfortunately, only works with base fields as described in http://developer.openstack.org/api-ref-compute-v2.1.html#showlimits

haphan commented 8 years ago

One implementation I can think of is as following. @jamiehannaford any comment?

$openstack = new OpenStack\OpenStack($params);
$limit = $openstack->blockStorageV2()->limits();
ivpfals commented 8 years ago

@haphan Thanks for clarification! Well I will use a workaround (calling the openstack commandline util via remote ssh) to fetch project's limit information, as I need the volume limits for my project. If I could help you with this issue just drop me a note!