Skip to content

Commit

Permalink
vsphere: do not set empty features and clock
Browse files Browse the repository at this point in the history
The features and clock settings are taken from the corresponding
template in kubevirt, if exists, we do not want to override them with
empty settings.

Signed-off-by: Arik Hadas <[email protected]>
  • Loading branch information
ahadas committed Nov 8, 2023
1 parent 38418a3 commit ae80c6e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/controller/plan/adapter/vsphere/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,14 +542,15 @@ func (r *Builder) mapInput(object *cnv.VirtualMachineSpec) {
}

func (r *Builder) mapClock(host *model.Host, object *cnv.VirtualMachineSpec) {
clock := &cnv.Clock{
Timer: &cnv.Timer{},
}
if host.Timezone != "" {
if object.Template.Spec.Domain.Clock == nil {
object.Template.Spec.Domain.Clock = &cnv.Clock{
Timer: &cnv.Timer{},
}
}
tz := cnv.ClockOffsetTimezone(host.Timezone)
clock.ClockOffset.Timezone = &tz
object.Template.Spec.Domain.Clock.ClockOffset.Timezone = &tz
}
object.Template.Spec.Domain.Clock = clock
}

func (r *Builder) mapMemory(vm *model.VM, object *cnv.VirtualMachineSpec) {
Expand All @@ -571,7 +572,6 @@ func (r *Builder) mapCPU(vm *model.VM, object *cnv.VirtualMachineSpec) {
}

func (r *Builder) mapFirmware(vm *model.VM, object *cnv.VirtualMachineSpec) {
features := &cnv.Features{}
firmware := &cnv.Firmware{
Serial: vm.UUID,
}
Expand All @@ -590,7 +590,6 @@ func (r *Builder) mapFirmware(vm *model.VM, object *cnv.VirtualMachineSpec) {
default:
firmware.Bootloader = &cnv.Bootloader{BIOS: &cnv.BIOS{}}
}
object.Template.Spec.Domain.Features = features
object.Template.Spec.Domain.Firmware = firmware
}

Expand Down

0 comments on commit ae80c6e

Please sign in to comment.