mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Fix separate storage config blocks device assignment
Move device assignment for CDROM's and disk storage to occur during finalize, to ensure that storage config blocks are merged before assigning devices. This ensures that defining multiple storage config blocks within the same or different Vagrantfiles that are merged, works as expected to create multiple separate storage devices without needing to explicitly define the dev name. Fixes #655
This commit is contained in:
parent
4af944f9d6
commit
46e0d09ce6
@ -432,7 +432,6 @@ module VagrantPlugins
|
||||
# as will the address unit number (unit=0, unit=1, etc)
|
||||
|
||||
options = {
|
||||
:dev => self._get_cdrom_dev(@cdroms),
|
||||
:bus => "ide",
|
||||
:path => nil,
|
||||
}.merge(options)
|
||||
@ -448,7 +447,6 @@ module VagrantPlugins
|
||||
|
||||
def _handle_disk_storage(options={})
|
||||
options = {
|
||||
:device => _get_device(@disks),
|
||||
:type => 'qcow2',
|
||||
:size => '10G', # matches the fog default
|
||||
:path => nil,
|
||||
@ -586,7 +584,15 @@ module VagrantPlugins
|
||||
|
||||
# Storage
|
||||
@disks = [] if @disks == UNSET_VALUE
|
||||
@disks.map! do |disk|
|
||||
disk[:device] = _get_device(@disks) if disk[:device].nil?
|
||||
disk
|
||||
end
|
||||
@cdroms = [] if @cdroms == UNSET_VALUE
|
||||
@cdroms.map! do |cdrom|
|
||||
cdrom[:dev] = _get_cdrom_dev(@cdroms) if cdrom[:dev].nil?
|
||||
cdrom
|
||||
end
|
||||
|
||||
# Inputs
|
||||
@inputs = [{:type => "mouse", :bus => "ps2"}] if @inputs == UNSET_VALUE
|
||||
|
@ -74,8 +74,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do
|
||||
end
|
||||
|
||||
context "without devices given" do
|
||||
xit "pending device assignment in finalize " +
|
||||
"should merge disks with different devices assigned automatically" do
|
||||
it "should merge disks with different devices assigned automatically" do
|
||||
one.storage(:file)
|
||||
two.storage(:file)
|
||||
subject.finalize!
|
||||
@ -97,8 +96,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do
|
||||
end
|
||||
|
||||
context "without devs given" do
|
||||
xit "pending cdroms merging support and device assignment in finalize " +
|
||||
"should merge cdroms with different devs assigned automatically" do
|
||||
it "should merge cdroms with different devs assigned automatically" do
|
||||
one.storage(:file, :device => :cdrom)
|
||||
two.storage(:file, :device => :cdrom)
|
||||
subject.finalize!
|
||||
|
Loading…
Reference in New Issue
Block a user