Skip to content

vmm: clear restore snapshot after device creation#157

Merged
tpressure merged 1 commit into
cyberus-technology:gardenlinuxfrom
phip1611:fix-snapshot-problem
May 19, 2026
Merged

vmm: clear restore snapshot after device creation#157
tpressure merged 1 commit into
cyberus-technology:gardenlinuxfrom
phip1611:fix-snapshot-problem

Conversation

@phip1611
Copy link
Copy Markdown
Member

@phip1611 phip1611 commented May 19, 2026

Different solution to #156. Please see the commit message for more details.

Fixes: https://github.com/cobaltcore-dev/cobaltcore/issues/567

Copy link
Copy Markdown

@olivereanderson olivereanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

A restore snapshot is only construction input. The restore path should
use it while rebuilding the VM from saved state, then discard it before
later VM lifecycle operations run.

Keeping it around is observable after a restored VM changes its device
set. For example, a VM can be restored from a snapshot, live-migrated,
and then hot-remove a device on the destination. The restored device
tree no longer contains that device, but DeviceManager still carries the
original device snapshot.

That stale snapshot can affect later hotplug. Every added device
eventually reaches a constructor that calls
state_from_id(self.snapshot.as_ref(), id) or an equivalent snapshot
lookup. If the stale snapshot still contains an entry with the newly
added device name, the new device is created with old saved state even
though the matching device was already removed from the live device
tree.

Clear the DeviceManager snapshot after hypervisor-specific
initialization has rebuilt the interrupt controller and devices. From
that point onward, device operations should behave as normal runtime
operations, not as restore operations.

Co-developed-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
Co-developed-by: Leander Kohler <leander.kohler@cyberus-technology.de>

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
@phip1611 phip1611 force-pushed the fix-snapshot-problem branch from 3b29e1b to 21f02f4 Compare May 19, 2026 08:42
@phip1611 phip1611 requested review from Coffeeri and tpressure May 19, 2026 08:46
Copy link
Copy Markdown

@Coffeeri Coffeeri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @tpressure and @phip1611!

Please run the libvirt test pipeline before merging this.

@tpressure tpressure merged commit eabdd84 into cyberus-technology:gardenlinux May 19, 2026
11 checks passed
@phip1611 phip1611 deleted the fix-snapshot-problem branch May 19, 2026 09:03
@phip1611
Copy link
Copy Markdown
Member Author

phip1611 commented May 19, 2026

Great work @tpressure and @phip1611!

Please run the libvirt test pipeline before merging this.

We both ran the test locally :) a new pipeline is running now including the CH bump: https://gitlab.cyberus-technology.de/cyberus/cloud/libvirt/-/merge_requests/209

@phip1611
Copy link
Copy Markdown
Member Author

Upstream PR: cloud-hypervisor#8251

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.

5 participants