mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Add ability to use emulated tpm (#1166)
Qemu has supported tpm 2 and the ability to start swtpm. Additionally
it expands the tests for the tpm configuration to ensure that only when
the options cause a change to the domain XML will the domain be updated
on a subsequent start. This change just allows passing through the
necessary config.
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
libvirt.tpm_model = "tpm-crb"
libvirt.tpm_type = "emulator"
libvirt.tpm_version = "2.0"
end
end
closes #965
This commit is contained in:
@@ -105,4 +105,28 @@ describe 'templates/domain' do
|
||||
expect(domain.to_xml('domain')).to eq xml_expected
|
||||
end
|
||||
end
|
||||
|
||||
context 'when tpm 2.0 device is specified' do
|
||||
before do
|
||||
domain.tpm_version = '2.0'
|
||||
domain.tpm_type = 'emulator'
|
||||
domain.tpm_model = 'tpm-crb'
|
||||
end
|
||||
let(:test_file) { 'tpm/version_2.0.xml' }
|
||||
it 'renders template' do
|
||||
domain.finalize!
|
||||
expect(domain.to_xml('domain')).to eq xml_expected
|
||||
end
|
||||
end
|
||||
|
||||
context 'when tpm 1.2 device is implicitly used' do
|
||||
before do
|
||||
domain.tpm_path = '/dev/tpm0'
|
||||
end
|
||||
let(:test_file) { 'tpm/version_1.2.xml' }
|
||||
it 'renders template' do
|
||||
domain.finalize!
|
||||
expect(domain.to_xml('domain')).to eq xml_expected
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user