Skip to content

Commit

Permalink
Add TPM to vsphere builder
Browse files Browse the repository at this point in the history
When having TPM device from the source, create it also for the
destination VM. The data is persist in ovirt. If supported by kubevirt
the TPM will be persistent TPM, otherwise the TPM without persistent
data.

Signed-off-by: Liran Rotenberg <lrotenbe@redhat.com>
  • Loading branch information
liranr23 committed Dec 25, 2023
1 parent c037efe commit c856758
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/controller/plan/adapter/vsphere/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ func (r *Builder) VirtualMachine(vmRef ref.Ref, object *cnv.VirtualMachineSpec,
r.mapMemory(vm, object)
r.mapClock(host, object)
r.mapInput(object)
r.mapTpm(vm, object)
err = r.mapNetworks(vm, object)
if err != nil {
return
Expand Down Expand Up @@ -639,6 +640,13 @@ func (r *Builder) mapDisks(vm *model.VM, persistentVolumeClaims []core.Persisten
object.Template.Spec.Domain.Devices.Disks = kDisks
}

func (r *Builder) mapTpm(vm *model.VM, object *cnv.VirtualMachineSpec) {
if vm.TpmEnabled {
persistData := true
object.Template.Spec.Domain.Devices.TPM = &cnv.TPMDevice{Persistent: &persistData}
}
}

// Build tasks.
func (r *Builder) Tasks(vmRef ref.Ref) (list []*plan.Task, err error) {
vm := &model.VM{}
Expand Down

0 comments on commit c856758

Please sign in to comment.