Product SiteDocumentation Site

14.4. Limiting Resource Usage

CloudStack allows you to control resource usage based on the types of resources, such as CPU, RAM, Primary storage, and Secondary storage. A new set of resource types has been added to the existing pool of resources to support the new 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, and Secondary storage. The root administrator is able 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 200.
max.account.secondary.storage (GB)
Maximum secondary storage space that can be used for an account.
Default is 400.
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 200.
max.project.secondary.storage (GB)
Maximum secondary storage space that can be used for an account.
Default is 400.

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.
  • The end users will the privilege to list resource limits. Use the listResourceLimits API.

14.4.2. Limit Usage Considerations

  • Primary or Secondary storage space refers to the stated size of the volume and not the physical size— the actual consumed size on disk in case of thin provisioning.
  • If the admin reduces the resource limit for an account and set it to less than the resources that are currently being consumed, the existing VMs/templates/volumes are not destroyed. Limits are imposed only if the user under that account tries to execute a new operation using any of these resources. 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-domains or accounts under that domain can have there own limits. However, the sum of resource allocated to a sub-domain or accounts under the domain at any point of time should not exceed the value X.
    For example, if a domain has the CPU limit of 40 and the 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 of 40.
  • If any operation needs to pass through two of more resource limit check, then the lower of 2 limits will be enforced, For example: if an account has the VM limit of 10 and CPU limit of 20, and a user under that account requests 5 VMs of 4 CPUs each. The user can deploy 5 more VMs because VM limit is 10. However, the user cannot deploy any more instances because the CPU limit has been exhausted.

14.4.3. Limiting Resource Usage in a Domain

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 the accounts in all the sub-domains of that domain. Limits set at the root domain level apply to the sum of resource usage by the accounts in all the 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.