Skip to content

feat(vmop): add operation supersede flow#2338

Open
danilrwx wants to merge 6 commits into
mainfrom
feat/vmop/displacement-vmop
Open

feat(vmop): add operation supersede flow#2338
danilrwx wants to merge 6 commits into
mainfrom
feat/vmop/displacement-vmop

Conversation

@danilrwx
Copy link
Copy Markdown
Contributor

@danilrwx danilrwx commented May 12, 2026

Description

Add the first VMOP supersede flow for compatible VirtualMachineOperation pairs.

Implemented changes:

  • add Superseded reason for the Completed VMOP condition;
  • add a supersede matrix for allowed and forbidden operation pairs;
  • allow admission for compatible supersede combinations and reject forbidden active-operation combinations;
  • mark older active VMOPs as Completed with Completed=True and reason=Superseded;
  • clean up older operation side effects for Start, Restart, Migrate and Evict;
  • make Stop idempotent when VMI is already absent;
  • make force Restart start a VM when VMI is absent;
  • add unit coverage for supersede scenarios;
  • document VMOP supersede behavior in the user guide.

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

Previously, any active VMOP for a VM blocked newer VMOPs until it finished. This made recovery and escalation scenarios inconvenient: for example, a pending Start could not be interrupted by Stop, and a graceful Stop could not be escalated to force Stop.

The supersede flow lets a newer compatible operation take precedence, safely completes the older operation as superseded, and lets the newer operation continue normally.

What is the expected result?

  1. Create a VMOP that stays active for a VM.
  2. Create a compatible newer VMOP for the same VM, for example:
    • Start -> Stop;
    • Stop -> Stop(force).
  3. Verify the older VMOP has:
    • status.phase: Completed;
    • Completed=True;
    • reason=Superseded.
  4. Verify the newer VMOP continues and completes normally.
  5. Create a forbidden pair, for example Stop -> Start or Start -> Start, and verify admission rejects the newer VMOP while the older operation is active.

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: core
type: feature
summary: Allow compatible VirtualMachineOperations to supersede older active operations.

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

test(api, vmop): align supersede e2e with framework style

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx added this to the v1.9.0 milestone May 12, 2026
danilrwx added 2 commits May 12, 2026 16:39
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx marked this pull request as ready for review May 14, 2026 07:31
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Comment thread images/virtualization-artifact/pkg/controller/vmop/supersede/supersede.go Outdated
Comment thread images/virtualization-artifact/pkg/controller/vmop/supersede/supersede.go Outdated
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx requested a review from yaroslavborbat May 14, 2026 11:59
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