Skip to content

Commit

Permalink
MTV-1866 | Remove the requests.memory from the builder
Browse files Browse the repository at this point in the history
Issue:
MTV is importing VMs with the requests.memory field and the memory.guest field set.
This is problematic as it prevents memor-overcommit and is causing un-necessary
memory pressure on VMs in the worst case leading to OOM sitiations.

Fix:
Remove the requests.memory from the builders

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

Signed-off-by: Martin Necas <mnecas@redhat.com>
  • Loading branch information
mnecas committed Jan 7, 2025
1 parent 82bd887 commit 2e93700
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 19 deletions.
4 changes: 0 additions & 4 deletions pkg/controller/plan/adapter/openstack/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,7 @@ func (r *Builder) mapResources(vm *model.Workload, object *cnv.VirtualMachineSpe

// TODO Support HugePages
memory := resource.NewQuantity(int64(vm.Flavor.RAM)*1024*1024, resource.BinarySI)
resourceRequests := map[core.ResourceName]resource.Quantity{}
resourceRequests[core.ResourceMemory] = *memory
object.Template.Spec.Domain.Memory = &cnv.Memory{Guest: memory}

object.Template.Spec.Domain.Resources.Requests = resourceRequests
}

func (r *Builder) getCpuCount(vm *model.Workload, imageCpuProperty string) (count uint32) {
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 @@ -316,11 +316,6 @@ func (r *Builder) mapMemory(vm *model.VM, object *cnv.VirtualMachineSpec) error
return err
}
reservation := resource.NewQuantity(memoryBytes, resource.BinarySI)
object.Template.Spec.Domain.Resources = cnv.ResourceRequirements{
Requests: map[core.ResourceName]resource.Quantity{
core.ResourceMemory: *reservation,
},
}
object.Template.Spec.Domain.Memory = &cnv.Memory{Guest: reservation}
return nil
}
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 @@ -362,11 +362,6 @@ func (r *Builder) mapClock(vm *model.Workload, object *cnv.VirtualMachineSpec) {

func (r *Builder) mapMemory(vm *model.Workload, object *cnv.VirtualMachineSpec) {
reservation := resource.NewQuantity(vm.Memory, resource.BinarySI)
object.Template.Spec.Domain.Resources = cnv.ResourceRequirements{
Requests: map[core.ResourceName]resource.Quantity{
core.ResourceMemory: *reservation,
},
}
object.Template.Spec.Domain.Memory = &cnv.Memory{Guest: reservation}
}

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 @@ -647,11 +647,6 @@ func (r *Builder) setMachine(object *cnv.VirtualMachineSpec) {
func (r *Builder) mapMemory(vm *model.VM, object *cnv.VirtualMachineSpec) {
memoryBytes := int64(vm.MemoryMB) * 1024 * 1024
reservation := resource.NewQuantity(memoryBytes, resource.BinarySI)
object.Template.Spec.Domain.Resources = cnv.ResourceRequirements{
Requests: map[core.ResourceName]resource.Quantity{
core.ResourceMemory: *reservation,
},
}
object.Template.Spec.Domain.Memory = &cnv.Memory{Guest: reservation}
}

Expand Down

0 comments on commit 2e93700

Please sign in to comment.