Skip to content

Commit

Permalink
Support provisioning flavors with no root disk
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Oct 17, 2024
1 parent 8a0db29 commit 1c59553
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module ManageIQ::Providers::Openstack::CloudManager::Provision::VolumeAttachment
def create_requested_volumes(requested_volumes)
volumes_attrs_list = [default_volume_attributes]
volumes_attrs_list = instance_type.root_disk_size > 0 ? [default_volume_attributes] : []

connection_options = {:service => "volume", :tenant_name => cloud_tenant.try(:name)}
source.ext_management_system.with_provider_connection(connection_options) do |service|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@

expect(@task.create_requested_volumes(@task.options[:volumes])).to eq [default_volume, requested_volume]
end

context "with root volume" do
@flavor = FactoryBot.create(:flavor_openstack, :root_disk_size => 0)

it "creates a bootable first volume" do
service = double
allow(service).to receive_message_chain('volumes.create').and_return @volume
allow(@task.source.ext_management_system).to receive(:with_provider_connection)
.with({:service => 'volume', :tenant_name => nil}).and_yield(service)
allow(@task).to receive(:instance_type).and_return(@flavor)

requested_volume = {:name => "root", :size => 2, :uuid => @volume.id, :source_type => "volume",
:destination_type => "volume"}

expect(@task.create_requested_volumes(@task.options[:volumes])).to eq [requested_volume]
end
end
end

context "#check_volumes" do
Expand Down

0 comments on commit 1c59553

Please sign in to comment.