Skip to content

KVM: createVolume / createTemplate from incremental snapshot fails randomly, managesnapshot.sh skips mkdir #14485

Open

Description

@Damans227

problem

With kvm.incremental.snapshot=true and snapshot.backup.to.secondary=false, createVolume or createTemplate from an incremental snapshot fails randomly with:

errorcode 530
Failed to copy snapshot: java.lang.RuntimeException: InvocationTargetException when invoking RPC callback for command: copySnapshotAsyncCallback

The agent log only says Failed to backup <uuid> ... to <secondary>/snapshots/<account>/<volume>. The real error is hidden because managesnapshot.sh sends qemu-img's output to /dev/null. I traced it on the host:

qemu-img convert ... : Could not create '<secondary>/snapshots/2/3/<uuid>': No such file or directory

What happens:

  1. Both calls copy the snapshot into snapshots/<account>/<volume> on secondary. After the call, the SSVM deletes the copy and also removes the folder if it's empty (NfsSecondaryStorageResource.java#L2116-L2120).
  2. On the next copy, backup_snapshot() only creates the folder if [ ! -d $destPath ] (managesnapshot.sh#L237-L245).
  3. If the host has the same secondary export mounted somewhere else (configdrive, template), the NFS client can still see the folder the SSVM just removed. mkdir is skipped and qemu-img fails (managesnapshot.sh#L285).

Every failed copy I traced had no mkdir before qemu-img. Every good one had it.

host-trace.log

versions

  • CloudStack 4.22.1.1, same code on main (0a5bf30)
  • KVM: Ubuntu 26.04, QEMU 10.2.1, libvirt 12.0.0
  • NFS 4.2 primary and secondary (Linux NFS server)

The steps to reproduce the bug

  1. KVM zone with NFS secondary. Set kvm.incremental.snapshot=true and snapshot.backup.to.secondary=false, restart the management server.
  2. On a KVM host, keep a subfolder of the same secondary export mounted, like a configdrive mount does:
    mount -t nfs -o vers=4.2 <secstore>:/<export>/configdrive /mnt/keep
  3. Deploy a VM on that host and take a full snapshot of its ROOT volume.
  4. Loop: createSnapshot (incremental), then createVolume from it, then createTemplate from it.

Without step 2 I got 0 failures in 8 rounds. With it, 6 of 12 rounds failed, all with the error above.

api-results.txt

mgmt-failed-jobs.log

Same failure shows in the UI ("Failed to create volume"):

Image
ui-repro.webm

What to do about it?

  • Run mkdir -p "$destPath" every time in backup_snapshot(). It's safe if the folder exists.
  • Keep qemu-img's error in the message sent back, so this shows up in the logs.
  • Maybe don't remove snapshots/<account>/<volume> when the temp copy is deleted.

Activity

  1. added this to the 4.22.3 milestone on Oct 27, 2026
  2. github-actions commented on Oct 30, 2026

    @github-actions

    Warning

    threat detection engine error
    The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

    What happened

    The threat detection engine failed to produce results.

    Review the workflow run logs for details.

    🎯 Triage report

    With kvm.incremental.snapshot=true and snapshot.backup.to.secondary=false, createVolume or createTemplate from an incremental snapshot fails intermittently with error 530. The reporter traced it to managesnapshot.sh: backup_snapshot() creates the destination folder only when it is missing, and the SSVM can remove that folder after a copy. On the host, qemu-img convert then fails with "No such file or directory". The reporter reproduced it with a second NFS mount of the same export on the host (for example a configdrive mount) and saw 6 of 12 rounds fail. Without the extra mount there were 0 failures in 8 rounds.

    📊 Assessment

    Dimension Value Reasoning
    Type type:bug Intermittent operation failure with a clear reproduction
    Component component:kvm Host-side managesnapshot.sh and KVM snapshot path
    Severity Severity:Major Snapshot-based volume and template creation fails; workaround exists
    Labels type:bug, component:kvm, Severity:Major
    Coding agent Suitable Fix is specified: run mkdir -p "$destPath" unconditionally, pass qemu-img stderr back, and stop removing the account/volume folder

    🔗 Similar issues

    💡 Notes and suggestions
    • Reproduction is in the report: mount a subfolder of the secondary export on a KVM host, then loop createSnapshot, createVolume, createTemplate on a ROOT volume.
    • The reporter attached host-trace and API result logs (GitHub user-attachments), which are not reproduced here.
    • The milestone is set to 4.22.3.

    Generated by Daily Issue Triage · copilot · haiku55 · ~3 AIC · ⊞ 3.8K · ◷

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/daily-issue-triage.md@139fa09ef17cde4135e696ff8e7af09bc5ddfa6e
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions