Skip to content

fix(vmrestore): drop usb devices in best effort clone#2076

Open
danilrwx wants to merge 1 commit intomainfrom
fix/usb/clone-besteffort
Open

fix(vmrestore): drop usb devices in best effort clone#2076
danilrwx wants to merge 1 commit intomainfrom
fix/usb/clone-besteffort

Conversation

@danilrwx
Copy link
Contributor

@danilrwx danilrwx commented Mar 6, 2026

Description

Fix VM clone behavior in BestEffort mode when source VM has attached USB devices.

The restore handler now filters out spec.usbDevices during clone validation for SnapshotOperationModeBestEffort, so clone creation is not blocked by USB dependencies.

Also extended unit tests in vm_restorer_test.go to verify:

  • USB devices are removed in BestEffort mode
  • USB devices are preserved in Strict mode

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

In BestEffort clone mode, we should tolerate dependencies that cannot be reproduced in the clone target.

USB devices may be busy or attached to another VM, and carrying them over to a cloned VM can cause clone failures or invalid restore behavior. This change makes BestEffort clone semantics consistent by dropping USB attachments from the cloned VM spec.

What is the expected result?

  1. Create a VM with spec.usbDevices.
  2. Run clone/restore in BestEffort mode.
  3. Verify the cloned VM is created successfully and has no spec.usbDevices.
  4. Run clone/restore in Strict mode.
  5. Verify spec.usbDevices are kept in the cloned VM.

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: fix
summary: Drop usb devices from VM clone spec in best effort restore mode.
impact_level: low

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx added this to the v1.7.0 milestone Mar 6, 2026
@danilrwx danilrwx marked this pull request as ready for review March 6, 2026 09:12
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.

1 participant