Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neonvm-controller: Use virtio-mem when status.memoryProvider is nil #1110

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pkg/neonvm/controllers/vm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,15 @@ func (r *VMReconciler) doReconcile(ctx context.Context, vm *vmv1.VirtualMachine)
vm.Status.SSHSecretName = fmt.Sprintf("ssh-neonvm-%s", vm.Name)
}

// Set memory provider for old VMs that don't have it in the Status.
// Forwards compatibility: Set virtio-mem memory provider for VMs that don't have it in the
// status.
// We need to do this so that when we switch to no longer setting memoryProvider, we won't
// regress and try to set it to dimm slots.
// See #1060 for the relevant tracking issue.
if vm.Status.PodName != "" && vm.Status.MemoryProvider == nil {
oldMemProvider := vmv1.MemoryProviderDIMMSlots
log.Error(nil, "Setting default MemoryProvider for VM", "MemoryProvider", oldMemProvider)
vm.Status.MemoryProvider = lo.ToPtr(oldMemProvider)
newMemProvider := vmv1.MemoryProviderVirtioMem
log.Error(nil, "Setting default MemoryProvider for VM", "MemoryProvider", newMemProvider)
vm.Status.MemoryProvider = lo.ToPtr(newMemProvider)
}

switch vm.Status.Phase {
Expand Down
Loading