Skip to content
Snippets Groups Projects
Verified Commit ba39ecbe authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Redo vTPM addition configuration

parent 21b48647
No related branches found
No related tags found
No related merge requests found
Pipeline #80889 failed
...@@ -7,18 +7,35 @@ module ForemanVmwareAdvanced ...@@ -7,18 +7,35 @@ module ForemanVmwareAdvanced
args[:extra_config] = (args[:extra_config] || {}).merge( args[:extra_config] = (args[:extra_config] || {}).merge(
'bios.bootOrder': 'ethernet0', 'bios.bootOrder': 'ethernet0',
'disk.EnableUUID': 'TRUE',
'svga.autodetect': 'TRUE' 'svga.autodetect': 'TRUE'
) )
if SETTINGS[:vtpm_csr] && SETTINGS[:vtpm_crt] args
args[:extra_config][:'vtpm.present'] = 'TRUE' end
args[:extra_config][:'vtpm.ekCSR'] = SETTINGS[:vtpm_csr]
args[:extra_config][:'vtpm.ekCRT'] = SETTINGS[:vtpm_crt]
end
args[:extra_config][:'disk.EnableUUID'] = 'TRUE' if args[:guest_id]&.start_with?('win') def create_vm(args = {})
vm = super(args)
return unless vm
args if SETTINGS[:vtpm_add] && vm.firmware == 'efi'
begin
spec = {
deviceChange: [
{
operation: :add,
device: RbVmomi::VIM::VirtualTPM.new(key: -1)
}
]
}
client.vm_reconfig_hardware 'instance_uuid' => vm.attributes[:instance_uuid], 'hardware_spec' => spec
rescue StandardError => e
logger.error "Failed to add vTPM - #{e.class}: #{e}"
end
end
vm
end end
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment