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
args[:extra_config] = (args[:extra_config] || {}).merge(
'bios.bootOrder': 'ethernet0',
'disk.EnableUUID': 'TRUE',
'svga.autodetect': 'TRUE'
)
if SETTINGS[:vtpm_csr] && SETTINGS[:vtpm_crt]
args[:extra_config][:'vtpm.present'] = 'TRUE'
args[:extra_config][:'vtpm.ekCSR'] = SETTINGS[:vtpm_csr]
args[:extra_config][:'vtpm.ekCRT'] = SETTINGS[:vtpm_crt]
end
args
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
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