Adding Attribute to Nova Hosts

I have a need to add attributes to nova hosts to pull data from other, internal systems to display to users in Horizon. Think of the attribute sort of like a foreign key. I was wondering what is the best way to go about doing this? I looked at the compute_nodes table in the nova database and thought I'd add the required column there (or a meta_data column and possibly push the change to the project for use by others in case anyone else needs to relate arbitrary data to a host), but then I saw the compute_node_stats table and how it's a key/value table and thought to add it there, instead, which would be way less invasive. Does this seem like a reasonable approach? Is there some other way of getting this accomplished that I haven't thought of?

1 answer

I think adding data to the compute_node_stats table would be pretty uninvasive, but since you would be manually entering data into that table, you'd have to watch out for migration updates. I don't believe that data manually added to this table would automatically be returned in API requests, though, so you would have to both manually add and manually retrieve the data. It might be easier to just make your own table or secondary database.

Host Aggregates allow arbitrary metadata to be applied to an aggregate. You could create one aggregate per compute node and then set your data that way. It's a bit of a round-about approach, though.

While looking around for other options, I came across the nova host-meta command. I thought this was just what you'd be looking for, but it turns out that this command applies a key=value to all instances on a host -- not on the host itself...