Flavors: interactions with other components — Nova — branch stable/2026.2
Branch
stable/2026.2@8df1922926dd— repository https://opendev.org/openstack/nova — analysed on 2026-10-28
| System | Direction | What |
|---|---|---|
API database (nova_api) | nova-api reads and writes | the flavor catalogue |
Cell databases (instance_extra.flavor) | nova-api, conductor and compute write | each server's copy of its flavor |
| Message bus (versioned notifications) | nova-api publishes | flavor.create, flavor.update, flavor.delete |
| Placement | scheduler | resource and trait request built from the flavor |
| Keystone | nova-api | project check when access is granted |
1. API database
Models in nova/db/api/models.py:225-281:
| Table | Columns | Constraints |
|---|---|---|
flavors | id int PK, name varchar(255) not null, memory_mb int not null, vcpus int not null, root_gb int, ephemeral_gb int, flavorid varchar(255) not null, swap int not null default 0, rxtx_factor float default 1, vcpu_weight int, disabled bool default false, is_public bool default true, description text, created_at, updated_at | unique flavorid, unique name |
flavor_extra_specs | id int PK, flavor_id FK → flavors.id, key varchar(255) not null, value varchar(255) | unique (flavor_id, key), index (flavor_id, key) |
flavor_projects | id int PK, flavor_id FK → flavors.id, project_id varchar(255) not null | unique (flavor_id, project_id) |
- No soft delete: rows are deleted (
nova/objects/flavor.py:179-196). - Flavor and extra specs are written in one transaction at creation (
nova/objects/flavor.py:143-175). - Extra-spec writes retry up to 10 times on duplicate-key races (
nova/objects/flavor.py:95-129). - Reads join the extra specs eagerly (
nova/objects/flavor.py:280-282). namefiltering uses the database's regular-expression operator, chosen from[database] connection(nova/objects/flavor.py:621-628) [inferred: the API database uses the same engine type as the cell database in normal deployments].
Representative list query for a non-admin user (nova/objects/flavor.py:600-653):
SELECT flavors.*, flavor_extra_specs.* FROM flavors
LEFT OUTER JOIN flavor_extra_specs ON flavor_extra_specs.flavor_id = flavors.id
WHERE (flavors.is_public = true
OR EXISTS (SELECT 1 FROM flavor_projects
WHERE flavor_projects.flavor_id = flavors.id AND flavor_projects.project_id = :project_id))
AND flavors.disabled = false
AND flavors.memory_mb >= :minRam AND flavors.root_gb >= :minDisk
ORDER BY flavors.flavorid ASC, flavors.id ASC LIMIT :limit
2. The server's copy (cell database)
instance_extra.flavor holds {"cur": <Flavor>, "old": <Flavor>|null, "new": <Flavor>|null}, each flavor serialised as an oslo versioned object (nova_object.name: Flavor, version 1.2, nova_object.data with the fields of 01 § 3 plus extra_specs and projects) (nova/objects/instance.py:749-762). description is set to null in the copy.
Legacy instances kept the flavor in instance_system_metadata as keys instance_type_<field> and instance_type_extra_<key>, with old_ and new_ prefixes (nova/compute/flavors.py:45-61, nova/compute/flavors.py:142-202). Only hw:numa_cpus.* and hw:numa_mem.* extra specs were kept there.
3. Notifications
flavor.create, flavor.update (description, extra specs or access changes) and flavor.delete, priority INFO, publisher nova-api:<host> (nova/objects/flavor.py:575-596). The payload is FlavorPayload 1.4 (nova/notifications/objects/flavor.py:32-61): flavorid, name, memory_mb, vcpus, root_gb, ephemeral_gb, swap, rxtx_factor, vcpu_weight, disabled, is_public, extra_specs, projects, description.
4. Placement
The scheduler turns the server's flavor (and image) into one GET /allocation_candidates request (01 § 5, nova/scheduler/utils.py:80-203). For example, a flavor vcpus=4, ram=8192, disk=40, swap=1024, hw:cpu_policy=dedicated, trait:HW_CPU_X86_AVX2=required gives:
resources=PCPU:4,MEMORY_MB:8192,DISK_GB:41&required=HW_CPU_X86_AVX2
The allocation is written against the compute node and kept as long as the server lives on it. A resize holds both the old and the new allocation until confirm or revert. See reverse-spec-placement.
Source: reverse-spec-nova/03-flavors-interactions_stable-2026.2.md. The _rewrite/ and _inventory/ files are not published on the site.