Flavors in Nova are templates that govern the size of instances by specifying the amount of RAM, CPU, and ephemeral volume space that gets allocated when the image is launched.
Creating the flavor:
- Create the flavor at the national layer. The example below would create a national flavor named akl.medium.gpu-k40, with auth UUID generation, 16GB RAM, 30GB ephemeral storage, and 4 CPUs. **1
nova flavor-create --is-public false 'email@example.com' auto 16386 30 4'.
- Create the flavor locally with the host aggregate as a prefix as below. **2
nova flavor-create --is-public False 'firstname.lastname@example.org' 03361fb9-36b5-4f93-ab5c-c6c95c058f42 16386 30
- Ask core services to look up the id for you on Slack #rc-ops: Hey core services, can you please look up the instance_types.id for my new flavor email@example.com?
Update the local DB (user nova, db nova) with this information: **3 update instance_types set id=667 where name='akl.medium.gpu-k40' limit 1
Assign Metadata to the Flavor:
Custom flavours are filtered based on their metadata. So for the example above, we don't want the flavour to be available anywhere in the availability zone, we want this to be limited to the GPU node. In this case, we set up a host aggregate and assign the GPU node to this host aggregate. We add the filter "gpu=true"
- We already assigned the "gpu=true" metadata to the aggregate metadata (you can confirm with the command "nova aggregate-details 'nectar!auckland@gpu'"). Add this same metadata to the flavor, so that they will be linked: nova flavor-key 'akl.medium.gpu-k40' set gpu=true. You can confirm with nova flavor-show akl.medium.gpu-k40 .
- Next we need to assign the PCI alias to the flavor, so that it will pass the PCI device through to the OS. nova flavor-key akl.medium.gpu-k40 set pci_passthrough:alias='K40m:1' **4
- Assign the flavor to a project. Search for the project ID with: 'openstack project list | grep Auckland' (for example). Then add the flavor to that ID: nova flavour-access-add akl.medium.gpu-k40 <id> . **5
**1 Nectar has a naming convention for custom flavors, and ours begins with "akl". Try to make the rest of it match the others (see nova flavor-list --all for examples).
**2 You can check the host aggregate by listing them: nova aggregate-list | grep auckland , also the ID in the example is listed when the first command is run in step 1.
**3 DB password for nova user in Secret Server
**4 There is a lot of procedure to set up a GPU host so that pci_passthrough works correctly (out of scope for here). Also note that the pci_alias must match what core services sets up (so request from them if this is a new GPU model). the Alias is also defined in a number of places in nova.conf on the GPU host, as well as in the nova controllers' nova.conf (in puppet).
**5 Can adjust project defaults with core services.