Skip to content

Commit

Permalink
MTV-1865 | Remove the q35 machine type
Browse files Browse the repository at this point in the history
Issue:
VMs imported from vSphere always have the q35 machine type set. but the machine type is "floating", and thus the VM abi can change between reboots (i.e. update from rhel 8 to rhel9 or 10 on the host side).

Fix:
Remove the q35 machine type.

Ref: https://issues.redhat.com/browse/MTV-1865

Signed-off-by: Martin Necas <[email protected]>
  • Loading branch information
mnecas committed Jan 6, 2025
1 parent bfb0a81 commit 94e357e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 17 deletions.
2 changes: 0 additions & 2 deletions pkg/controller/plan/adapter/openstack/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,6 @@ func (r *Builder) mapInput(vm *model.Workload, object *cnv.VirtualMachineSpec) {
}

func (r *Builder) mapResources(vm *model.Workload, object *cnv.VirtualMachineSpec, usesInstanceType bool) {
// KubeVirt supports Q35 or PC-Q35 machine types only.
object.Template.Spec.Domain.Machine = &cnv.Machine{Type: Q35}
if usesInstanceType {
return
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/controller/plan/adapter/ova/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ func (r *Builder) VirtualMachine(vmRef ref.Ref, object *cnv.VirtualMachineSpec,
}
r.mapDisks(vm, persistentVolumeClaims, object)
r.mapFirmware(vm, vmRef, object)
r.setMachine(object)
r.mapInput(object)
if !usesInstanceType {
r.mapCPU(vm, object)
Expand Down Expand Up @@ -325,10 +324,6 @@ func (r *Builder) mapMemory(vm *model.VM, object *cnv.VirtualMachineSpec) error
return nil
}

func (r *Builder) setMachine(object *cnv.VirtualMachineSpec) {
object.Template.Spec.Domain.Machine = &cnv.Machine{Type: "q35"}
}

func (r *Builder) mapCPU(vm *model.VM, object *cnv.VirtualMachineSpec) {
if vm.CoresPerSocket == 0 {
vm.CoresPerSocket = 1
Expand Down
5 changes: 0 additions & 5 deletions pkg/controller/plan/adapter/ovirt/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ func (r *Builder) VirtualMachine(vmRef ref.Ref, object *cnv.VirtualMachineSpec,
}
r.mapDisks(vm, persistentVolumeClaims, object)
r.mapFirmware(vm, &vm.Cluster, object)
r.setMachine(object)
if !usesInstanceType {
r.mapCPU(vm, object)
r.mapMemory(vm, object)
Expand Down Expand Up @@ -370,10 +369,6 @@ func (r *Builder) mapMemory(vm *model.Workload, object *cnv.VirtualMachineSpec)
object.Template.Spec.Domain.Memory = &cnv.Memory{Guest: reservation}
}

func (r *Builder) setMachine(object *cnv.VirtualMachineSpec) {
object.Template.Spec.Domain.Machine = &cnv.Machine{Type: "q35"}
}

func (r *Builder) mapCPU(vm *model.Workload, object *cnv.VirtualMachineSpec) {
object.Template.Spec.Domain.CPU = &cnv.CPU{
Sockets: uint32(vm.CpuSockets),
Expand Down
5 changes: 0 additions & 5 deletions pkg/controller/plan/adapter/vsphere/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,6 @@ func (r *Builder) VirtualMachine(vmRef ref.Ref, object *cnv.VirtualMachineSpec,
}
r.mapDisks(vm, vmRef, persistentVolumeClaims, object)
r.mapFirmware(vm, object)
r.setMachine(object)
if !usesInstanceType {
r.mapCPU(vm, object)
r.mapMemory(vm, object)
Expand Down Expand Up @@ -640,10 +639,6 @@ func (r *Builder) mapClock(host *model.Host, object *cnv.VirtualMachineSpec) {
}
}

func (r *Builder) setMachine(object *cnv.VirtualMachineSpec) {
object.Template.Spec.Domain.Machine = &cnv.Machine{Type: "q35"}
}

func (r *Builder) mapMemory(vm *model.VM, object *cnv.VirtualMachineSpec) {
memoryBytes := int64(vm.MemoryMB) * 1024 * 1024
reservation := resource.NewQuantity(memoryBytes, resource.BinarySI)
Expand Down

0 comments on commit 94e357e

Please sign in to comment.