mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Fix issue where custom cpu model is ignored (Fixes #864)
This commit is contained in:
parent
413a413304
commit
1539f15d4a
@ -615,6 +615,8 @@ module VagrantPlugins
|
|||||||
'qemu64'
|
'qemu64'
|
||||||
elsif @cpu_mode != 'custom'
|
elsif @cpu_mode != 'custom'
|
||||||
''
|
''
|
||||||
|
else
|
||||||
|
@cpu_model
|
||||||
end
|
end
|
||||||
@cpu_topology = {} if @cpu_topology == UNSET_VALUE
|
@cpu_topology = {} if @cpu_topology == UNSET_VALUE
|
||||||
@cpu_fallback = 'allow' if @cpu_fallback == UNSET_VALUE
|
@cpu_fallback = 'allow' if @cpu_fallback == UNSET_VALUE
|
||||||
|
46
spec/unit/templates/domain_custom_cpu_model.xml
Normal file
46
spec/unit/templates/domain_custom_cpu_model.xml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<domain type='' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||||
|
<name></name>
|
||||||
|
<uuid></uuid>
|
||||||
|
<memory></memory>
|
||||||
|
<vcpu>1</vcpu>
|
||||||
|
|
||||||
|
|
||||||
|
<cpu mode='custom'>
|
||||||
|
<model fallback='allow'>SandyBridge</model>
|
||||||
|
</cpu>
|
||||||
|
|
||||||
|
|
||||||
|
<os>
|
||||||
|
<type>hvm</type>
|
||||||
|
<kernel></kernel>
|
||||||
|
<initrd></initrd>
|
||||||
|
<cmdline></cmdline>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<acpi/>
|
||||||
|
<apic/>
|
||||||
|
<pae/>
|
||||||
|
</features>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<devices>
|
||||||
|
|
||||||
|
|
||||||
|
<serial type='pty'>
|
||||||
|
<target port='0'/>
|
||||||
|
</serial>
|
||||||
|
<console type='pty'>
|
||||||
|
<target port='0'/>
|
||||||
|
</console>
|
||||||
|
|
||||||
|
|
||||||
|
<input type='mouse' bus='ps2'/>
|
||||||
|
|
||||||
|
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' />
|
||||||
|
<video>
|
||||||
|
<model type='cirrus' vram='9216' heads='1'/>
|
||||||
|
</video>
|
||||||
|
|
||||||
|
|
||||||
|
</devices>
|
||||||
|
|
||||||
|
</domain>
|
@ -81,4 +81,16 @@ describe 'templates/domain' do
|
|||||||
expect(domain.to_xml('domain')).to eq xml_expected
|
expect(domain.to_xml('domain')).to eq xml_expected
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when custom cpu model enabled' do
|
||||||
|
before do
|
||||||
|
domain.cpu_mode = 'custom'
|
||||||
|
domain.cpu_model = 'SandyBridge'
|
||||||
|
end
|
||||||
|
let(:test_file) { 'domain_custom_cpu_model.xml' }
|
||||||
|
it 'renders template' do
|
||||||
|
domain.finalize!
|
||||||
|
expect(domain.to_xml('domain')).to eq xml_expected
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user