Comment 4 for bug 1715570

Revision history for this message
Matt Riedemann (mriedem) wrote :

One issue with fixing this in the simple tenant usage API is we pull potentially a lot of instances out of the database and it would be inefficient to call nova.compute.utils.is_volume_backed on each one. We could stash an is_bfv flag in the instance_system_metadata table but that's also not very efficient, and not something we join on today in that API (since joining on that table is also inefficient).

One thought is if we can add a joinedload column in the instances model so that we can query the DB API asking for this is_bfv joinedload column to be populated which would essentially do, via joins in the DB query, what nova.compute.utils.is_volume_backed already checks, which is:

1. Does the instance have related block_device_mappings records?
2. Does one of those records have boot_index=0?
3. Does that record have destination_type='volume'?

If so, it's a volume-backed server. Then we could just joinedload that column in the DB query, pull it off the instance object in the API and get our flag.