Skip to content

Commit

Permalink
compute: treat images without hypervisor_type as baremetal and vmware
Browse files Browse the repository at this point in the history
  • Loading branch information
andypf committed May 13, 2024
1 parent cad7984 commit 70e92fb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions plugins/compute/app/helpers/compute/instances_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,24 @@ def grouped_images(images, bootable_volumes = nil, hv_type)
.each_with_object({}) do |image, map|
next if image.name.nil?

hypervisor_type = image.hypervisor_type || "baremetal"
visibility = image.visibility
visibility = "snapshot" if image.image_type == "snapshot"
map[visibility] ||= {}
map[visibility][hypervisor_type] ||= []
map[visibility][hypervisor_type] << image

# some years ago we decided to treat images without hypervisor_type as baremetal.
# From now on we will treat them as both baremetal and vmware because
# thus images run on both hypervisors.

# images that have no hypervisor_type are treated as both baremetal and vmware
if image.hypervisor_type.nil?
map[visibility]["baremetal"] ||= []
map[visibility]["vmware"] ||= []
map[visibility]["baremetal"] << image
map[visibility]["vmware"] << image
else
map[visibility][image.hypervisor_type] ||= []
map[visibility][image.hypervisor_type] << image
end
end
.sort

Expand Down

0 comments on commit 70e92fb

Please sign in to comment.