Previous Topic: user ObjectNext Topic: log Object


quota Object

Use this object to control user and group grid resource usage using quota specifications.

Method

Description

config

Define and manage warning and burst default thresholds for the grid

list

List quota entries for users and groups

info

Details quota entries for a specified user or group

put

Set quota values for a user or a group

modify

Change quota data for a user or a group

config Method (quota Object)
Description

Display or set default warning and burst thresholds for the grid.

Syntax

Get threshold values:

/api/v2/quota/config?vdc=controller-name

Set threshold values:

/api/v2/quota/config?vdc=controller-name&warn=warning-level&burst=burst-level
Arguments
vdc

Name of the target virtual data center

warn

Percentage of the grid’s resources past which consumption a warning is issued. 0 disables warnings.

Limits: 0-99

burst

Percentage of the grid’s resources past which consumption a warning is issued. 0 disables resource usage beyond quota.

Notes:

  • The warning and burst levels defined for the grid only apply to users and groups that are not assigned specific values already.
  • These values are read-only, except for grid administrators.
Transaction Type

synchronous

Request Type

GET

Examples

Display default quota thresholds for a grid:

GET http://192.168.123.200/api/v2/quota/config?vdc=mygrid

Set the default warning threshold to 70%:

GET http://192.168.123.200/api/v2/quota/config?warn=70&vdc=mygrid
Sample Output
XML:
<quota_config>
  <burst>0</burst>
  <warn>75</warn>
</quota_config>
JSON:
{
   "quota_config" : {
      "warn" : "75",
      "burst" : "0"
   } 
} 

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.7

Invalid value ‘value’ specified for ‘resource’ parameter - The value assigned to the warn or burst parameter is out of range.

list Method (quota Object)
Description

List quota entries for all users and groups of a grid.

Syntax
/api/v2/quota/list?vdc=controller-name 
Arguments
vdc

Name of the target virtual data center

principal (optional)

User or group for whom to display quota information. See Common Argument Types for details.

Transaction Type

synchronous

Request Type

GET

Examples

Obtain a detailed list of all quota entries:

GET http://192.168.123.200/api/v2/quota/list?vdc=mygrid&verbose
Sample Output
XML:

<quotas>
  <quota>
    <disk_used>724566016</disk_used>
    <principal>all</principal>
    <scope>local</scope>
    <type>group</type>
  </quota>
  <quota>
    <burst>75</burst>
    <bw_allowed>17500000000</bw_allowed>
    <bw_assigned>10000000000</bw_assigned>
    <bw_available>10000000000</bw_available>
    <cpu_allowed>17.5</cpu_allowed>
    <cpu_assigned>10</cpu_assigned>
    <cpu_available>17.5</cpu_available>
    <description>Sample User</description>
    <disk_allowed>37580963840</disk_allowed>
    <disk_assigned>21474836480</disk_assigned>
    <disk_available>20750270464</disk_available>
    <disk_used>724566016</disk_used>
    <mem_allowed>18790481920</mem_allowed>
    <mem_assigned>10737418240</mem_assigned>
    <mem_available>10737418240</mem_available>
    <principal>ak</principal>
    <scope>local</scope>
    <type>user</type>
    <warn>75</warn>
  </quota>
</quotas>
JSON:

{
   "quota" : [
      {
         "principal" : "all",
         "type" : "group",
         "scope" : "local",
         "disk_used" : "724566016"
      },
      {
         "bw_allowed" : "17500000000",
         "bw_assigned" : "10000000000",
         "principal" : "ak",
         "disk_available" : "20750270464",
         "disk_assigned" : "21474836480",
         "mem_available" : "10737418240",
         "warn" : "75",
         "scope" : "local",
         "burst" : "75",
         "description" : "Sample User",
         "cpu_allowed" : "17.5",
         "mem_allowed" : "18790481920",
         "cpu_assigned" : "10",
         "bw_available" : "10000000000",
         "mem_assigned" : "10737418240",
         "type" : "user",
         "cpu_available" : "17.5",
         "disk_used" : "724566016",
         "disk_allowed" : "37580963840"
      }
   ]
}
HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

info Method (quota Object)
Description

Display quota information for a specified user or group.

Syntax
/api/v2/quota/info?principal=a-principal&vdc=controller-name 
Arguments
vdc

Name of the target virtual data center

principal

User or group for whom to display quota information. A principal specification is one of the following:

<name>

Local user or group

/<name>

Global user or group

<scope>:<type>:<name>

A fully qualified principal name

where:

  • <scope> is global or local
  • <type> is group or user
  • <name> is the group or the user name
Transaction Type

synchronous

Request Type

GET

Examples

Display information for a user named john@CA.com.

GET http://192.168.123.200/api/v2/quota/info?principal=local:user:john@ca.com
Sample Output
XML:
<quota>
  <burst>90</burst>
  <principal>
    <name>laura@ca.com</name>
    <scope>local</scope>
    <type>user</type>
  </principal>
  <resources allowed>
    <bw>1900000000</bw>
    <cpu>11</cpu>
    <disk>95000000000</disk>
    <mem>19000000000</mem>
  </resources allowed>
  <resources assigned>
    <bw>1000000000</bw>
    <cpu>6</cpu>
    <disk>50000000000</disk>
    <mem>10000000000</mem>
  </resources assigned>
  <warn>80</warn>
</quota>
JSON:
{
   "quota" : {
      "warn" : "80",
      "burst" : "90",
      "principal" : {
         "name" : "laura@ca.com",
         "type" : "user",
         "scope" : "local"
      },
      "resources assigned" : {
         "bw" : "1000000000",
         "cpu" : "6",
         "disk" : "50000000000",
         "mem" : "10000000000"
      },
      "resources allowed" : {
         "bw" : "1900000000",
         "cpu" : "11",
         "disk" : "95000000000",
         "mem" : "19000000000"
      }
   }
}
HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

404.1

Entity not found - There is no principal name match for principal.

400.4

Bad request syntax (URL) - missing required argument (principal).

put Method (quota Object)
Description

Sets quota information for a user or group.

Syntax
/api/v2/quota/put?principal=a-principal&vdc=controller-name 
Arguments
vdc

Name of the target virtual data center

principal

User or group for whom to set quota information. A principal specification is one of the following:

<name>

Local user or group

/<name>

Global user or group

<scope>:<type>:<name>

A fully qualified principal name

where:

  • <scope> is global or local
  • <type> is group or user
  • <name> is the group or the user name
description

Arbitrary printable ASCII character string. Replace characters such as spaces with their hexadecimal representation (%hh), according to URL syntax.

tags=tag1,tag2,…,tagN

Comma-separated list of tags sometimes used for billing purposes.

parent=group-name

Reference to the parent group quota. Because users have their parent group set to their primary group, you can only set this argument for a group.

cpu=value

Resource usage limits for processors.

mem=value

Resource usage limits for memory (bytes).

bw=value

Resource usage limits for bandwidth (bytes per second).

disk=value

Resource usage limits for disk space (bytes).

warn=percentage

Warning consumption threshold (as a percentage of total resources available), for the considered principal.

burst=percentage

Burst resource consumption threshold (as a percentage of total resources available), for the considered principal.

Transaction Type

synchronous

Request Type

GET

Examples

Set quota values for a local user of the grid mygrid named john:

Get http://192.168.123.200/api/v2/quota/put?principal=local:user:john&vdc=mygrid&cpu=4&mem=200000000&bw=1000&disk=100000000000
Sample Output
XML:
Upon success:

<message></message>
Upon exceeded quota:

<opt>
  <error>404.1</error>
  <message>Entity not found - Error: User Daniel has reached its bandwidth quota of 100.00 Mbps.</message>
</opt>
JSON:
{
   "message" : ""
}

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.7

Invalid value value specified for resource parameter. The value assigned to the warn or burst parameter is out of range.

404.1

Entity not found - There is no principal name match for principal.

400.4

Bad request syntax (URL) - missing required argument (principal).

modify Method (quota Object)
Description

Modifies existing quota information for a user or a group.

Syntax
/api/v2/quota/modify?principal=a-principal&vdc=controller-name 
Arguments
vdc

Name of the target virtual data center

principal

User or group for whom to update quota information. A principal specification is one of the following:

<name>

Local user or group

/<name>

Global user or group

<scope>:<type>:<name>

A fully qualified principal name

where:

  • <scope> is global or local
  • <type> is group or user
  • <name> is the group or the user name
description

Arbitrary printable ASCII character string. Replace characters such as spaces with their hexadecimal representation (%hh), according to URL syntax.

tags=tag1,tag2,…,tagN

Comma-separated list of tags sometimes used for billing purposes.

parent=group-name

Reference to the parent group quota. Because users have their parent group set to their primary group, you can only set this argument for a group.

cpu=value

Resource usage limits for processors.

mem=value

Resource usage limits for memory (bytes).

bw=value

Resource usage limits for bandwidth (bytes per second).

disk=value

Resource usage limits for disk space (bytes).

warn=percentage

Warning consumption threshold (as a percentage of total resources available), for the considered principal.

burst=percentage

Burst resource consumption threshold (as a percentage of total resources available), for the considered principal.

Transaction Type

synchronous

Request Type

GET

Examples

Modify existing quota values for a local user of the grid mygrid named john:

Get http://192.168.123.200/api/v2/quota/modify?principal=local:user:john&vdc=mygrid&cpu=5&mem=50000000&bw=2000&disk=50000000000&warn=85&burst=90
Sample Output
XML:
Upon success:

<message></message>
Upon exceeded quota:

<opt>
  <error>404.1</error>
  <message>Entity not found - Error: User Laura has reached its bandwidth quota of 953.67 MB.</message>
</opt>
JSON:
{
   "message" : ""
}

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.7

Invalid value value specified for resource parameter. The value assigned to the warn or burst parameter is out of range.

404.1

Entity not found - There is no principal name match for principal.

400.4

Bad request syntax (URL) - missing required argument (principal).