Fix issue where custom cpu model is ignored (Fixes #864)

This commit is contained in:
Michael Darwish 2018-02-14 13:13:41 -05:00
parent 413a413304
commit 1539f15d4a
3 changed files with 60 additions and 0 deletions

View File

@ -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

View 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>

View File

@ -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