Product SiteDocumentation Site

14.4. Limiting Resource Usage

In addition to VMs, volumes, and snapshots, CloudStack allows you limit resource types, such as CPU, RAM, Primary storage, Secondary storage, and Network Rate.
Previously in CloudStack, resource usage limit was imposed based on the resource count, that is, restrict a user or domain on the basis of the number of VMs, volumes, or snapshots used. A new set of resource types has been added to the existing pool of resources (VMs, Volumes, and Snapshots) to support the customization model—need-basis usage, such as large VM or small VM. The new resource types are now broadly classified as CPU, RAM, Primary storage, Secondary storage, and Network Rate. CloudStack now allows the root administrator to impose resource usage limit by the following resource types for Domain, Project and Accounts.
To control the behaviour of this feature, the following configuration parameters have been added:
Parameter Name
Description
max.account.cpus
Maximum number of CPU cores that can be used for an account.
Default is 40.
max.account.ram (MB)
Maximum RAM that can be used for an account.
Default is 40960.
max.account.primary.storage (GB)
Maximum primary storage space that can be used for an account.
Default is 20*10.
max.account.secondary.storage (GB)
Maximum secondary storage space that can be used for an account.
Default is 20*20.
max.account.network.rate (Mbps)
Maximum network rate that can be used for an account.
Default is 200.
max.project.cpus
Maximum number of CPU cores that can be used for an account.
Default is 40.
max.project.ram (MB)
Maximum RAM that can be used for an account.
Default is 40960.
max.project.primary.storage (GB)
Maximum primary storage space that can be used for an account.
Default is 20*10.
max.project.secondary.storage (GB)
Maximum secondary storage space that can be used for an account.
Default is 20*20.
max.project.network.rate (Mbps)
Maximum network rate that can be used for an account.
Default is 200.

14.4.1. User Permission

The root administrator, domain administrators and users are able to list resources. Ensure that proper logs are maintained in the vmops.log and api.log files.
  • The root admin will have the privilege to list and update resource limits.
  • The domain administrators are allowed to list and change these resource limits only for the sub-domains and accounts under their own domain or the sub-domains.
  • Normal users would have privilege to list resource limits. Use the listResourceLimits API.

14.4.2. Use Cases and Considerations

  • When you refer to Primary or Seconday storage space, it implies that the stated size of the volume and not the physical size— the actual consumed size on disk in case of thin provisioning.
  • If admin reduces the resource limit for an account and set it to less than the resources currently consumed by that account, the existing VMs/templates/volumes are destroyed. Using those resources, limits are imposed if the user under that account tries to execute a new operation. For example, the existing behavior in the case of a VM are:
    • migrateVirtualMachine: The users under that account will be able to migrate the running VM into any other host without facing any limit issue.
    • recoverVirtualMachine: Destroyed VMs cannot be recovered.
  • For any resource type, if a domain has limit X, sub-domain or accounts under that domain can have there own limits, but at any point of time the sum of resource allocated to sub-domain or accounts under the domain should never exceed the value X.
    For example, if a domain has the CPU limit of 40 and sub-domain D1 and account A1 can have limits of 30 each, but at any point of time the resource allocated to D1 and A1 should not exceed the limit 40.
  • If any operation needs to pass through two of more resource limit check, then the lower of 2 limits will be enforced, For e.g. if an account has VM limit of 10 and CPU limit of 20 and user under that account requests 5 VMs of 4 CPUs each, after this user can deploy 5 more VMs(because VM limit is 10) but user has exhausted his CPU limit and cannot deploy any more instance.

14.4.3. Per-Domain Limits

CloudStack allows the configuration of limits on a domain basis. With a domain limit in place, all users still have their account limits. They are additionally limited, as a group, to not exceed the resource limits set on their domain. Domain limits aggregate the usage of all accounts in the domain as well as all accounts in all sub-domains of that domain. Limits set at the root domain level apply to the sum of resource usage by the accounts in all domains and sub-domains below that root domain.
To set a domain limit:
  1. Log in to the CloudStack UI.
  2. In the left navigation tree, click Domains.
  3. Select the domain you want to modify. The current domain limits are displayed.
    A value of -1 shows that there is no limit in place.
  4. Click the Edit button editbutton.png: edits the settings.
  5. Edit the following as per your requirement:
    Parameter Name
    Description
    Instance Limits
    The number of instances that can be used in a domain.
    Public IP Limits
    The number of public IP addresses that can be used in a domain.
    Volume Limits
    The number of disk volumes that can be created in a domain.
    Snapshot Limits
    The number of snapshots that can be created in a domain.
    Template Limits
    The number of templates that can be registered in a domain.
    VPC limits
    The number of VPCs that can be created in a domain.
    CPU limits
    The number of CPU cores that can be used for a domain.
    Memory limits (MB)
    The number of RAM that can be used for a domain.
    Primary Storage limits (GB)
    The primary storage space that can be used for a domain.
    Secondary Storage limits (GB)
    The secondary storage space that can be used for a domain.
  6. Click Apply.

14.4.4. Default Account Resource Limits

You can limit resource use by accounts. The default limits are set by using global configuration parameters, and they affect all accounts within a cloud. The relevant parameters are those beginning with max.account, for example: max.account.snapshots.
To override a default limit for a particular account, set a per-account resource limit.
  1. Log in to the CloudStack UI.
  2. In the left navigation tree, click Accounts.
  3. Select the account you want to modify. The current limits are displayed.
    A value of -1 shows that there is no limit in place.
  4. Click the Edit button. editbutton.png: edits the settings
  5. Edit the following as per your requirement:
    Parameter Name
    Description
    Instance Limits
    The number of instances that can be used in an account.
    The default is 20.
    Public IP Limits
    The number of public IP addresses that can be used in an account.
    The default is 20.
    Volume Limits
    The number of disk volumes that can be created in an account.
    The default is 20.
    Snapshot Limits
    The number of snapshots that can be created in an account.
    The default is 20.
    Template Limits
    The number of templates that can be registered in an account.
    The default is 20.
    VPC limits
    The number of VPCs that can be created in an account.
    The default is 20.
    CPU limits
    The number of CPU cores that can be used for an account.
    The default is 40.
    Memory limits (MB)
    The number of RAM that can be used for an account.
    The default is 40960.
    Primary Storage limits (GB)
    The primary storage space that can be used for an account.
    The default is 200.
    Secondary Storage limits (GB)
    The secondary storage space that can be used for an account.
    The default is 400.
  6. Click Apply.