Skip to content

fix(cli): force handling for VM lifecycle operations initiated via CLI/VMOP#2168

Merged
danilrwx merged 2 commits intomainfrom
fix/cli/force-stop
Mar 30, 2026
Merged

fix(cli): force handling for VM lifecycle operations initiated via CLI/VMOP#2168
danilrwx merged 2 commits intomainfrom
fix/cli/force-stop

Conversation

@danilrwx
Copy link
Copy Markdown
Contributor

@danilrwx danilrwx commented Mar 30, 2026

Description

Fix force handling for VM lifecycle operations initiated via CLI/VMOP:

  1. CLI stop now correctly propagates --force to VirtualMachineOperation.spec.force.
  2. VMOP restart now honors spec.force in the powerstate controller and performs force restart path when requested.

Previously:

  • d8 v stop --force had no effect because CLI hardcoded force=false for Stop VMOP.
  • VirtualMachineOperation with type=Restart and spec.force=true was processed via graceful restart annotation path, effectively ignoring force behavior.

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

Users expect force lifecycle actions to be applied consistently:

  • stop --force should trigger force stop semantics.
  • restart --force should trigger immediate restart semantics (force path), not graceful shutdown waiting behavior.

These fixes align implementation with API contract and documented spec.force semantics.

What is the expected result?

  1. Run d8 v stop <vm> --force.
  2. Created VirtualMachineOperation has spec.force=true and force-stop behavior is applied.
  3. Create VirtualMachineOperation with type=Restart and spec.force=true.
  4. Controller uses force restart path (powerstate.RestartVM(..., true)) instead of annotation-only graceful path.

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: vmop
type: fix
summary: "Force handling fixed for VM lifecycle operations: CLI stop now passes --force, and VMOP restart now honors spec.force in controller logic."

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx added this to the v1.8.0 milestone Mar 30, 2026
@danilrwx danilrwx marked this pull request as ready for review March 30, 2026 12:27
@danilrwx danilrwx requested a review from Isteb4k as a code owner March 30, 2026 12:27
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx changed the title fix(cli): pass --force to stop VirtualMachineOperation fix(cli): force handling for VM lifecycle operations initiated via CLI/VMOP Mar 30, 2026
@danilrwx danilrwx self-assigned this Mar 30, 2026
@danilrwx danilrwx merged commit b1dd229 into main Mar 30, 2026
37 of 44 checks passed
@danilrwx danilrwx deleted the fix/cli/force-stop branch March 30, 2026 14:32
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