Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Creating a Tenant, a Project, and a Quota

shoenisch edited this page Apr 18, 2017 · 1 revision

Got a brand new installation of Photon Controller and not sure what to do next? The following examples demonstrate how to start working with Photon Controller from scratch by creating a tenant, a project, and a quota.

The commands assume that you have installed Photon Controller, have installed the Photon Controller CLI on a Linux workstation, and have access to the Photon Controller YAML file that you used to deploy Photon Controller. You can use the values in the YAML deployment file to replace the user names, passwords, and other variables that appear in curly brackets.

Set the Target to the Load Balancer

Get the IP address of the load balancer from your Photon Controller YAML deployment file and use it to set the target of the Photon Controller CLI on your workstation:

photon target set -c https://{load-balancer-ip}:443

Login

Log in as a Photon Controller administrator so that you can create tenants.

photon target login --username {lightwave-user-name}@{lightware-domain} 
                  --password '{lightwave-user-password}'

Create Tenant

Create a new tenant with an allocation of resources---that is, a quota:

	photon tenant create 'Tom' -l 'vm 2000 COUNT, vm.cost 2000 COUNT, 
  vm.cpu 2000 COUNT, vm.memory 2000 GB, ephemeral-disk 2000 COUNT, 
  ephemeral-disk.capacity 2000 GB, ephemeral-disk.cost 2000 GB, 
  persistent-disk 2000 COUNT, persistent-disk.capacity 2000 GB, 
  persistent-disk.cost 2000 GB, storage.LOCAL_VMFS 2000 COUNT, 
  storage.VSAN 2000 COUNT, sdn.floatingip.size 2000 COUNT'
    Comma-separated security group names, or hit enter for no security groups):
    CREATE_TENANT completed for 'tenant' entity cedc852f-f403-4cb0-9d7f-2614329a4229  

Even though the term quota does not appear in the preceding command, the resource counts that the command allocates are the quota for this tenant.

List Tenants

photon tenant list

You should see the one you just created.

Set Tenant

Set the tenant to Tom:

photon tenant set Tom

Create a Project with a Quote

Create a project with quota. The project quota must be a subset of its tenant quota.

 photon project create TomProj1 
--tenant Tom 
--limits 'vm 100 COUNT, vm.memory 1000 GB, vm.cpu 500 COUNT'

List the Projects

photon project list
ID                                    Name      Limit              Usage
c6955c9d-ba88-4555-a2ad-8cd93c15d4fc  TomProj1  vm 100 COUNT       vm 0 COUNT
                                                vm.cpu 500 COUNT   vm.cpu 0 COUNT
                                                vm.memory 1000 GB  vm.memory 0 GB

Create Another Project Using 30 Percent of the Quota

Next, create a second project. This project uses 30 percent of its tenant's quota.

photon project create TomProj2 --tenant Tom --percent 30
 
Tenant name: Tom
Creating project name: TomProj2
 
Please make sure limits below are correct:
1: subdivide.percent, 0.3, COUNT
Are you sure [y/n]? y
CREATE_PROJECT completed for 'project' entity 802798a0-07b7-4fc5-b645-bf0c6212e62d

List the Projects Again

Now there should be two of projects:

photon project list
ID          Name      Limit                             Usage
80279...    TomProj2  storage.LOCAL_VMFS 6000 COUNT     storage.LOCAL_VMFS 0 COUNT
                      storage.VSAN 6000 COUNT           storage.VSAN 0 COUNT
                      vm 6000 COUNT                     vm 0 COUNT
                      vm.memory 6000 GB                 vm.memory 0 GB
                      persistent-disk 6000 COUNT        persistent-disk 0 COUNT
                      persistent-disk.capacity 6000 GB  persistent-disk.capacity 0 GB
                      ephemeral-disk.cost 6000 GB       ephemeral-disk.cost 0 GB
                      persistent-disk.cost 6000 GB      persistent-disk.cost 0 GB
                      sdn.floatingip.size 6000 COUNT    sdn.floatingip.size 0 COUNT
                      vm.cost 6000 COUNT                vm.cost 0 COUNT
                      vm.cpu 6000 COUNT                 vm.cpu 0 COUNT
                      ephemeral-disk 6000 COUNT         ephemeral-disk 0 COUNT
                      ephemeral-disk.capacity 6000 GB   ephemeral-disk.capacity 0 GB
c6955...    TomProj1  vm 100 COUNT                      vm 0 COUNT
                      vm.cpu 500 COUNT                  vm.cpu 0 COUNT
                      vm.memory 1000 GB                 vm.memory 0 GB

Be careful not to make your quotas too big, or bigger than they need to be, to avoid getting a quota error.

When you create a VM, the “vm.memory” and “vm.cpu” are required keys for compute. For storage, you must specify ephemeral-disk and ephemeral-disk.capacity if you created a persistent disk. Other quota items are optional.

Show Tenant Quota

Now, take a look at the quota for the tenant:

photon tenant quota show Tom
Limits:
  storage.VSAN              2000  COUNT
  ephemeral-disk.capacity   2000  GB
  persistent-disk.capacity  2000  GB
  vm.cost                   2000  COUNT
  vm.memory                 2000  GB
  ephemeral-disk            2000  COUNT
  persistent-disk.cost      2000  GB
  persistent-disk           2000  COUNT
  vm.cpu                    2000  COUNT
  ephemeral-disk.cost       2000  GB
  storage.LOCAL_VMFS        2000  COUNT
  sdn.floatingip.size       2000  COUNT
  vm                        2000  COUNT
Usage:
  persistent-disk.capacity  6000  GB
  vm.cost                   6000  COUNT
  vm.memory                 7000  GB
  ephemeral-disk            6000  COUNT
  storage.VSAN              6000  COUNT
  ephemeral-disk.capacity   6000  GB
  ephemeral-disk.cost       6000  GB
  storage.LOCAL_VMFS        6000  COUNT
  sdn.floatingip.size       6000  COUNT
  vm                        6100  COUNT
  persistent-disk.cost      6000  GB
  persistent-disk           6000  COUNT
  vm.cpu                    6500  COUNT 

Show Project Quota

And drill down into the one of the project's quotas by using the project's ID:

photon project quota show c6955c9d-ba88-4555-a2ad-8cd93c15d4fc
Limits:
  vm.cpu     500   COUNT
  vm.memory  1000  GB
  vm         100   COUNT
Usage:
  vm.cpu     0   COUNT
  vm.memory  0   GB
  vm         0   COUNT

Updating Quotas

If you forgot to provide a quota item or didn't provide enough resources when you created a tenant or project, you can use the quota update command to make adjustments.

Note that you might get an error when updating a quota if you attempt to lower a quota limit below its current usage.

Update a Tenant's Quota

For example, here's how to add a missing vm.count to a quota:

photon tenant quota update Tom -l 'vm.count 2000 COUNT'
Tenant name: Tom
Please make sure limits below are correct:
1: vm.count, 2000, COUNT
Are you sure [y/n]? y
UPDATE_QUOTA completed for 'tenant' entity cedc852f-f403-4cb0-9d7f-2614329a4229          

Update a Project Quota

You can also update a project's quota. As an example, this command increases the vm.cpu quota to 1000:

photon project quota update c6955c9d-ba88-4555-a2ad-8cd93c15d4fc -l 'vm.cpu 1000 COUNT'
Project Id: c6955c9d-ba88-4555-a2ad-8cd93c15d4fc
Please make sure limits below are correct:
1: vm.cpu, 1000, COUNT
Are you sure [y/n]? y
UPDATE_QUOTA completed for 'project' entity c6955c9d-ba88-4555-a2ad-8cd93c15d4fc 

Verify your change:

photon project quota show c6955c9d-ba88-4555-a2ad-8cd93c15d4fc
Limits:
  vm.count   200   COUNT
  vm.cpu     1000  COUNT
  vm.memory  1000  GB
  vm         100   COUNT
Usage:
  vm.count   0   COUNT
  vm.cpu     0   COUNT
  vm.memory  0   GB
  vm         0   COUNT

Removing Entries from a Quota

Here's how to exclude a quota entry for a project's quota:

photon project quota exclude c6955c9d-ba88-4555-a2ad-8cd93c15d4fc -l 'vm.count 200 COUNT'
 
Project Id: c6955c9d-ba88-4555-a2ad-8cd93c15d4fc
Please make sure limits below are correct:
1: vm.count, 200, COUNT
Are you sure [y/n]? y
DELETE_QUOTA completed for 'project' entity c6955c9d-ba88-4555-a2ad-8cd93c15d4fc

And here's how to do it for a tenant's quota:

photon tenant quota exclude Tom -l 'vm.count 2000 COUNT'
 
Tenant name: Tom
Please make sure limits below are correct:
1: vm.count, 2000, COUNT
Are you sure [y/n]? y
DELETE_QUOTA completed for 'tenant' entity cedc852f-f403-4cb0-9d7f-2614329a4229

Keep in mind that a project quota consumes part of a tenant's quota. When removing a quota item, remember to remove the consumer first.

Setting Quota

Setting a quota totally wipes out the existing quota and replaces it with the new quota:

photon project quota set c6955c9d-ba88-4555-a2ad-8cd93c15d4fc -l 'vm 500 COUNT'
 
Project Id: c6955c9d-ba88-4555-a2ad-8cd93c15d4fc
Please make sure limits below are correct:
1: vm, 500, COUNT
Are you sure [y/n]? y
RESET_QUOTA completed for 'project' entity c6955c9d-ba88-4555-a2ad-8cd93c15d4fc

Check your work:

photon project quota show c6955c9d-ba88-4555-a2ad-8cd93c15d4fc
Limits:
  vm  500  COUNT
Usage:
  vm  0   COUNT

Now that you've created a tenant, a project, and a quota, move on to creating a VM.

Clone this wiki locally