diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb index 12218a0..0977ea4 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb @@ -615,6 +615,8 @@ module VagrantPlugins 'qemu64' elsif @cpu_mode != 'custom' '' + else + @cpu_model end @cpu_topology = {} if @cpu_topology == UNSET_VALUE @cpu_fallback = 'allow' if @cpu_fallback == UNSET_VALUE diff --git a/spec/unit/templates/domain_custom_cpu_model.xml b/spec/unit/templates/domain_custom_cpu_model.xml new file mode 100644 index 0000000..e4875fc --- /dev/null +++ b/spec/unit/templates/domain_custom_cpu_model.xml @@ -0,0 +1,46 @@ + + + + + 1 + + + + SandyBridge + + + + + hvm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spec/unit/templates/domain_spec.rb b/spec/unit/templates/domain_spec.rb index 9b83249..5b700af 100644 --- a/spec/unit/templates/domain_spec.rb +++ b/spec/unit/templates/domain_spec.rb @@ -81,4 +81,16 @@ describe 'templates/domain' do expect(domain.to_xml('domain')).to eq xml_expected 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