[Nova] - OS_TYPE - Setting after the fact.

Steven Relf srelf at ukcloud.com
Mon Nov 15 10:21:13 UTC 2021

Hello List,

I have the following situation and would be thankful for any help or suggestions.

We provide images to our customers, upon which we set the os_type metadata. We use this to help schedule instances to host aggregates, so we can control where certain OS's land. This works great for new instances, that are created from our images.

We have the following problems though.

  1.  Instances created prior to the introduction of the os_type metadata existing on the image, this metadata is not flowed down, and as such these instances have NULL
  2.  Instances created from a snapshot do not seem to get the os_type flowed down
  3.  Instances imported using our migration tool do not end up with the os_type being set either.

Currently the only way I can see to set os_type on an instance is to manually (yuk) update the database for each and every instance, which is missing it.

Does anyone have any ideas how this can be updated without manually modifying the database.

My second thought was to maybe make use of the instance metadata that you can set via the CLI or API, but then I run in to the issue that there is not a nova filter that is able to use instance metadata, and in my brief play with the code, it looks like (user) metadata is not passed in as part of the instance spec dict that is used to schedule instances.

I was thinking of writing a custom filter, but I'm not sure how compliant it would be to have a function making a call to try and collect the instance metadata.

In summary, I need to solve two things.

  1.  How do I set os_type on instances in a way that doesn't involve editing the database.
  2.  Or How can I use another piece of metadata that I can set via the api, which also is exposed to the filter scheduler.


The future has already arrived. It's just not evenly distributed yet - William Gibson

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20211115/ed2fbab7/attachment-0001.htm>

More information about the openstack-discuss mailing list