Add COMPUTE_NODE trait

We have at least one use case [1] for identifying resource providers
which represent compute nodes. There are a few ways we could do that
hackishly (e.g. [2], [3]) but the clean way is to have nova-compute mark
the provider with a trait, since nova-compute knows which one it is
anyway.

This commit adds a COMPUTE_NODE trait for this purpose.

[1] https://review.opendev.org/#/c/670112/7/nova/cmd/manage.py@2921
[2] Assume a provider with a certain resource class, like MEMORY_MB, is
always a compute node. This is not necessarily future-proof (maybe all
MEMORY_MB will someday reside on NUMA node providers; similar for other
resource classes) and isn't necessarily true in all cases today anyway
(ironic nodes don't have MEMORY_MB inventory) and there's also currently
no easy way to query for that (GET /resource_providers?MEMORY_MB:1 won't
return "full" providers, and you can't ask for :0).
[3] Assume a root provider without the MISC_SHARES_VIA_AGGREGATE trait
is a compute node. This assumes you're only using placement for nova-ish
things.

Change-Id: I036dd5cab15144447df5346814d5f0e8fd91135d
This commit is contained in:
Eric Fried 2019-10-16 11:15:11 -05:00
parent fc685f9e3b
commit 308fef9702
1 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,10 @@
TRAITS = [
# The virt driver supports associating a tag with a device *at boot time*
'DEVICE_TAGGING',
# A provider with this trait is a compute *node*. (As distinct from
# "compute host" or "hypervisor". These may be synonymous in some cases,
# but the distinction matters e.g. when using the ironic virt driver.)
'NODE',
# The virt driver supports trusted image certificate validation
'TRUSTED_CERTS',
]