Organization quota definition-questions


Ponraj E
 

Hi,

Is it possible to get the disk quota at an organization level? As far as I see, the quota definition api doesnt return the disk quota[upper limit] info?

I want to calculate the used disc quota/Total disk quota for an organization.


Regards,
Ponraj


Ponraj E
 

Hi,



Since the documentation for the quota definition is quite unclear at the moment, have more questions reg the same.

I want to display the resource consumption (memory,disk usage,etc) at the org and space level.

1. Sometimes the sum of space quota definition exceeds the org quota definition. Is this a valid use case or bug?
2. Currently at an org level, there is no API to display the disk quota limit/usage, but its only at the application level.How do we approach this?
3. Also at the space level, there is a possibility that a space not being associated with the space quota definition. So, how do we get the total resources available(like memory, services, routes) for this space?

Regards,
Ponraj


Juan Antonio Breña Moral <bren at juanantonio.info...>
 

Good morning,

yes it is possible.

If you observe PWS panel or Bluemix you can observe that information.

Every organization has binded a OrganizationQuota and this definition affects to every applicattion deployed in any spaces binded to that organization.

The REST methods used to get the definition is:

http://apidocs.cloudfoundry.org/213/organization_quota_definitions/retrieve_a_particular_organization_quota_definition.html

The method to read the memory used is:

http://apidocs.cloudfoundry.org/222/organizations/retrieving_organization_memory_usage.html

You have an example here:
https://github.com/prosociallearnEU/cf-nodejs-dashboard/blob/master/services/HomeService.js#L69-L79

Remember that the memory used is the active memory. You can many applications staged but stopped. When you sum memory to the counter is when you start a new application to set of applications running in a space.

Juan Antonio


Ponraj E
 

Hi Juan Antonio,

Thanks for the reply.

The API that you have mentioned gives me the memory usage of the org and not the disk quota/usage of the org. I need to know this info. In addition to that, I have added couple of more questions in my latest reply.

1. Sometimes the sum of space quota definition exceeds the org quota definition. Is this a valid use case or bug?
2. Currently at an org level, there is no API to display the disk quota limit/usage, but its only at the application level.How do we approach this?
3. Also at the space level, there is a possibility that a space not being associated with the space quota definition. So, how do we get the total resources available(like memory, services, routes) for this space?


Regards,
Ponraj


Juan Antonio Breña Moral <bren at juanantonio.info...>
 

Hi,

You have the reason. Disk quota is a parameter defined to app level only.
http://apidocs.cloudfoundry.org/213/apps/creating_an_app.html

When you create a new App, you define a set of parameters and one of them is disk of quota but when you define a Org Quota, disk_quota is not defined at that level.
http://apidocs.cloudfoundry.org/213/organization_quota_definitions/creating_a_organization_quota_definition.html

I am not sure if someone from Pivotal could confirm this fact, but I think that CC API doesn't have that feature at org/space level.

Anyway, at the moment, using the API, it is possible to do the same task but not in a direct way:

IDEA:

spaces = getSpacesFromOrg(org_guid)
long org_disk_quota = 0;
for each(space in spaces) {
apps = getAppsFromSpace(space_guid)
for each(app in apps) {
app_stat = getAppSummary(app_guid) or getAppStats(app_guid)
http://apidocs.cloudfoundry.org/226/apps/get_app_summary.html
http://apidocs.cloudfoundry.org/226/apps/get_detailed_stats_for_a_started_app.html
org_used_disk = app_stat.getDiskQuota();
}
}
System.out.println("Disk quota for current org: " + org_used_disk);

Juan Antonio


Juan Antonio Breña Moral <bren at juanantonio.info...>
 

Sorry, before I didn't reply some questions.

1. Didn't test it. In my tests, I defined a quota at org level but I will test it.
2. I answered with the pseudocode.
3. The space adquired the limits defined in the quota for the organization.

Juan Antonio