Introduction

Purpose

Currently in CloudStack, the admin can limit the resources managed by CloudStack by setting limits for accounts and domains. But these existing limits are based on resource count, that limits the user on the basis of no. of VMs, no. of Volumes, no. of snapshots etc. and not of the basis of storage space, CPU, memory etc.

This feature will add new (CPU, RAM, Primary storage, Secondary storage, network rate etc.) resource types to the existing pool of resources. CS admin would be able to set the limits i.e. CPU, memory, storage etc. for accounts/domains through API or through CloudStack UI. This is functional specifications of feature CLOUDSTACK-713.

Current Scenario

References

Feature Specifications

Use cases

Domain D1 , Account A1 and  Project P1

1. Number of CPUs:

    1. Root/Domain-Admin update CPU to 10 for domain D1. Users belonging to Domain D1 should not be able to use more than that.
    2. Root/Domain-Admin update CPU to 10 for Account A1 in Domain D1. Users belonging to Account A1 should not be able to use more than that. Also, they should not cross CPU limit defined for D1 domain.
    3. Limits imposed on Domain D1 should be imposed on sub-domain SD1 as well.
    4. Root/Domain-Admin update CPU to 10 for Project P1 having account A1 . Users belonging to Project P1 should not be able to use more CPUs than the defined limit.

2. Amount of RAM:

    1. Root/Domain-Admin update RAM to 1GB for domain D1. Users belonging to Domain D1 should not be able to use more than that.
    2. Root/Domain-Admin update RAM to 1GB for Account A1 in Domain D1. Users belonging to Account A1 should not be able to use more than that. Also, they should not cross RAM limit defined for D1 domain.
    3. Limits imposed on Domain D1 should be imposed on sub-domain SD1 as well.
    4. Root/Domain-Admin update RAM to 1GB for Project P1 having account A1. Users belonging to Project P1 should not be able to use more RAM than the defined limit.

3. Amount of Primary Storage:

    1. Root/Domain-Admin update primary storage to 5GB for domain D1. Users belonging to Domain D1 should not be able to use more than that.
    2. Root/Domain-Admin update primary storage to 5GB for Account A1 in Domain D1. Users belonging to Account A1 should not be able to use more than that. Also, they should not cross primary storage limit defined for D1 domain.
    3. Limits imposed on Domain D1 should be imposed on sub-domain SD1 as well.
    4. Root/Domain-Admin update primary storage to 5GB for Project P1 having account A1. Users belonging to Project P1 should not be able to use more primary storage than the defined limit.

4. Amount of Secondary Storage:

    1. Root/Domain-Admin update secondary storage to 5GB for domain D1. Users belonging to Domain D1 should not be able to use more than that.
    2. Root/Domain-Admin update secondary storage to 5GB for Account A1 in Domain D1. Users belonging to Account A1 should not be able to use more than that. Also, they should not cross secondary storage limit defined for D1 domain.
    3. Limits imposed on Domain D1 should be imposed on sub-domain SD1 as well.
    4. Root/Domain-Admin update secondary storage to 5GB for Project P1 having account A1. Users belonging to Project P1 should not be able to use more secondary storage than the defined limit.

5. Network bandwidth rate:

  1.  
    1. Root/Domain-Admin update network bandwidth rate to 200mbps for domain D1. Users belonging to Domain D1 should not be able to use more than that.
    2. Root/Domain-Admin update network bandwidth rate to 200mbps for Account A1 in Domain D1. Users belonging to Account A1 should not be able to use more than that. Also, they should not cross network bandwidth rate limit defined for D1 domain.
    3. Limits imposed on Domain D1 should be imposed on sub-domain SD1 as well.
    4. Root/Domain-Admin update network bandwidth rate to 200mbps for Project P1 having account A1. Users belonging to Project P1 should not be able to use more network bandwidth rate than the defined limit.

6. If admin reduces the total no. of VM limit for an account and set it to less then the total no. of currently running VMs under that account, the existing behaviour of CS for the following commands are:

    1. migrateVirtualMachine: User under that account will be able to migrate the running VM into any other host without facing any limit issue.
    2. recoverVirtualMachine: If user destroy one of the running VMs and later if he tries to recover it, CS will not allow this operation.

Architecture and Design description

Existing API Changes:

1. updateResourceLimit

ApiName

Request Parameters

Response Parameters

Available to regular user

updateResourceLimit

  • resourcetype (admin can pass new resource type to update CPU, RAM, primary storage, secondary storage and network rate)
  • account
  • domainid
  • max
  • projectid
  • account
  • domain
  • domainid
  • max
  • project
  • projectid
  • resourcetype

No

In the above mentioned API, admin can pass the newly added resource types to set the limits.

2. updateResourceCount

ApiName

Request Parameters

Response Parameters

Available to regular user

updateResourceCount

  • domainid
  • account
  • projectid
  • resourcetype (admin can pass new resource type to update CPU, RAM, primary storage, secondary storage *and network rate*)
  • account
  • domain
  • domainid
  • project
  • projectid
  • resourcecount
  • resourcetype

No

In the above mentioned API, admin can pass the newly added resource types to get the resource count.

3. listResourceLimits 

  This API is available to regular users and this will list the resource limits including the new resource types.

Example:

http://localhost:8080/client/api?command=updateResourceLimit&resourcetype=9&max=1024&domainid=2&apikey=pFZ6ZdlN-TmlBQWJRhncYUAUFCOGk3aCbbLGRAqtSG3KnbYnTEHXvh1MP-Y5801JAn-aFPODB-7vl1P8DiPQ1A&signature=6he37Flw1zRwNDe0yejyHk6oXcE%3d

DB Changes:

No DB Changes.

Changes to Existing Files:

Design Decisions: TBD

UI flow

_