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

Flavors

shoenisch edited this page Apr 18, 2017 · 11 revisions

A flavor is a named collection of costs for a VM or disk image. Flavors are closely related to quotas: The costs that a flavor specifies are subtracted from the total allocation in the quota you are using.

To create VM or disk, you must specify both an image and a flavor.

Types of flavors

There are three types of flavors:

  • vm: A VM flavor specifies the costs in creating a VM.
  • ephemeral-disk: Ephemeral disks are used for your boot disks when creating a VM.
  • persistent-disk: Persistent disks can be attached to your VMs and can persist after a VM is removed.

Flavor Costs

You can make any set of costs for a flavor that you want as long as you follow some rules:

  • A single cost is a number (fractional numbers are allowed) and a unit. Units can be B, KB, MB, GB (for size) or COUNT (for totals).

  • VM flavors must specify both the vm.cpu cost (this is a COUNT), and the vm.memory cost (units are B, KB, MB, or GB). For example, a VM flavor that specifies 2 CPUs and 4 GB of memory looks specifies costs as "vm.cpu 2 COUNT, vm.memory 4 GB". With the Photon CLI, it looks like this:

    photon -n flavor create --name "vm-cpu-memory" --kind "vm" 
                            --cost "vm.cpu 2 COUNT, vm.memory 4 GB"
    
  • If you want to limit the total number of VMs a user can create, you’d make a “vm COUNT” cost. Extending the example above, the costs would be: "vm 1 COUNT, vm.cpu 2 COUNT, vm.memory 4 GB". This doesn’t have to be named “vm”, but it’s a conventional way to do it. There must be a corresponding limit in the quota.

  • If you want to specify other costs, you can do so. For example, you can make a “vm.calories COUNT” cost. The meaning of this is entirely up to you. Photon Controller will ensure the user doesn’t exceed their calorie limit, but will not assign special meaning when managing the VM.

  • When a VM is created, it's boot disk must specify a flavor, and that flavor must specify a cost. A typical disk flavor only specifies the count. For ephemeral disks, the cost would be “ephemeral-disk 1 COUNT”, for persistent disks the cost would be "persistent-disk 1 COUNT"

  • Disk flavors must not specify the capacity: this is calculated from the size of the boot disk image or the size of the disk that is created.

Creating Flavors

You create flavors by using the photon flavor create command. You'll be prompted for a few details. Here's an example:

photon flavor create
Flavor name: tiny
Flavor kind (persistent-disk, ephemeral-disk, or vm): vm

Limit 1 (ENTER to finish)
Key: vm.cpu
Value: 1
Unit: COUNT

Limit 2 (ENTER to finish)
Key: vm.memory
Value: 512
Unit: MB

Limit 3 (ENTER to finish)
Key: 
Creating flavor: 'tiny', Kind: 'vm'

Please make sure the limits below are correct: 
1: vm.cpu, 1, COUNT
2: vm.memory, 512, MB
Are you sure [y/n]? y
Using target 'https://10.18.155.101:443'
Created flavor ID: d168da40-71d2-4ccf-ac94-eda8fa3b081c 

The complete help output for the command contains additional examples:

photon flavor create -h
NAME:
   photon flavor create - Create a flavor
USAGE:
   photon flavor create [command options]  
DESCRIPTION:
   This creates a new flavor. Only system administrators can create flavors.
   A flavor is defined by a set of costs. Each cost has a type (e.g. vm.memory),
   a numnber (e.g. 1) and a unit (e.g. GB). VM flavors must specify at
   least two costs: vm.memory and vm.cpu. Disk flavors must specify at
   least one cost, and it's typically the number of disk (typically one)
   Valid units:  GB, MB, KB, B, or COUNT
   Common costs:
     vm.count:               Number of VMs this is (probably 1 COUNT)
     vm.cpu:                 Number of vCPUs for a VM (use with COUNT)
     vm.memory:              Amount of RAM for a VM (use with GB, MB, KB, or B)
     persistent-disk.count:  Number of persistent disk (probably 1 COUNT)
     ephemeral-disk.count:   Number of ephemeral disks (probably 1 COUNT)
   Example VM flavor command:
      photon flavor create --name f1 --kind vm 
                           --cost 'vm.memory 1 GB, vm.cpu 1 COUNT'
   Example disk flavor:
      photon flavor create --name f1 --kind persistent-disk.count 
                           --cost 'persistent-disk.count 1 COUNT'
OPTIONS:
   --name value, -n value  Flavor name
   --kind value, -k value  Flavor kind: persistent-disk, ephemeral-disk, or vm
   --cost value, -c value  Comma-separated costs. Each cost is "type number unit"

List All Flavors

You can list all flavors configured on the system; abridged example:

photon flavor list
Using target 'https://10.18.155.101:443'
ID                                    Name        Kind            Cost
d168da40-71d2-4ccf-ac94-eda8fa3b081c  tiny        vm              vm.cpu 1 COUNT
                                                                  vm.memory 512 MB
Total: 6

Show Flavor Details

To see details about the flavor, run the photon flavor show <id> command:

photon flavor show d168da40-71d2-4ccf-ac94-eda8fa3b081c
Using target 'https://10.18.155.101:443'
Flavor ID: d168da40-71d2-4ccf-ac94-eda8fa3b081c
  Name:  tiny
  Kind:  vm
  Cost:  [vm.cpu 1 COUNT vm.memory 512 MB]
  State: READY
Clone this wiki locally