Skip to content

openvmm: failed publication cleanup can leave a restorable snapshot while the source resumes #1153

Closed

Description

@tangruize

If publication fails after independent-copy staging is complete, a subsequent cleanup failure can leave an openable snapshot while the source VM resumes. Restoring that leftover can start a second copy of the same VM.

In openvmm/openvmm_helpers/src/snapshot/publish.rs, StagingDirectory::rollback handles failed cleanup of independent staging this way:

        if let Err(cleanup_error) = self.remove_staging_directory() {
            tracing::warn!(
                error = cleanup_error.as_ref() as &dyn std::error::Error,
                "failed to remove independent snapshot staging artifacts"
            );
        }
        SnapshotWriteError::BeforeCommit(error)
    }

BeforeCommit is treated as rollback-safe, allowing the quiesced source to resume. Nothing was committed to the destination, but the sibling staging directory can already contain the manifest, saved state and complete memory image. Failed cleanup of a live source-RAM alias instead returns CleanupUncertain; independent copies are not covered by that safeguard.

Trigger

Complete staging, fail the final directory rename, and fail removal of the staging directory. The independent-copy branch reports BeforeCommit despite retaining a restorable image.

Proposed Fix

Decide whether a completed leftover must prevent source resume. Returning CleanupUncertain when its removal cannot be established would terminate the source, preserving the single-running-instance guarantee at the cost of stopping a VM for a host filesystem cleanup failure. Alternatively, permit resume only after invalidating the leftover so it cannot be restored.

The publication documentation and rollback outcome should describe the same guarantee; merely warning about a complete leftover does not resolve its ownership.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions