Skip to content

fix(vmop): prevent Maintenance mode from getting stuck during restore#2144

Merged
danilrwx merged 3 commits into
mainfrom
fix/vmop/maintenance-true-for-completed
Mar 24, 2026
Merged

fix(vmop): prevent Maintenance mode from getting stuck during restore#2144
danilrwx merged 3 commits into
mainfrom
fix/vmop/maintenance-true-for-completed

Conversation

@danilrwx
Copy link
Copy Markdown
Contributor

@danilrwx danilrwx commented Mar 24, 2026

Description

Return reconcile.Result{} instead of nil from two snapshot restore steps to properly complete the reconciliation loop when exiting early.

Changes in:

  • exit_maintenance_step.go — return &reconcile.Result{}, nil after setting Maintenance condition to False
  • waiting_disk_ready_step.go — return &reconcile.Result{}, nil when VirtualDisk is already Ready

Why do we need it, and what problem does it solve?

When performing a snapshot restore, the VM can get stuck in Maintenance mode indefinitely. This happens because returning nil from a reconcile step causes the controller to skip requeue, but the VM's Maintenance condition was already updated. Without requeue, subsequent reconciliations never process the next steps in the restore pipeline.

What is the expected result?

  1. Start VirtualMachineOperation restore
  2. VM enters Maintenance mode
  3. Snapshot restore completes successfully
  4. VM exits Maintenance mode and becomes Ready

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: vm
type: fix
summary: Fixed an issue where a virtual machine could get stuck in the `Maintenance` state during restore from a snapshot.

Return reconcile.Result instead of nil to properly complete the reconciliation
loop when snapshot steps exit early (exit maintenance step, waiting disk ready step).

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx marked this pull request as ready for review March 24, 2026 16:11
@danilrwx danilrwx added this to the v1.7.0 milestone Mar 24, 2026
yaroslavborbat
yaroslavborbat previously approved these changes Mar 24, 2026
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx merged commit 8b2b353 into main Mar 24, 2026
22 of 23 checks passed
@danilrwx danilrwx deleted the fix/vmop/maintenance-true-for-completed branch March 24, 2026 16:26
Isteb4k pushed a commit that referenced this pull request Mar 25, 2026
…#2144)

* fix(vmop): prevent Maintenance mode from getting stuck during restore

Return reconcile.Result instead of nil to properly complete the reconciliation
loop when snapshot steps exit early (exit maintenance step, waiting disk ready step).

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>

* fix(vmop): set maintenance condition to false instead of early return

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>

---------

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
(cherry picked from commit 8b2b353)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants