Commit Graph
1 Commits
Author SHA1 Message Date
Andrii Sultanov 4a277e62c1 scripts: Add helper script to list possibly leftover VBDs due to VM.revert regression
A regression was introduced to VM.revert in xapi-26.1.4-3.3, which left VBDs
attached to the VM when they are not present in the reverted-to
snapshot (instead of destroying such VBDs, as was done before).

VMs that were reverted to their snapshots after xapi-26.1.4-3.3 may have
such "leftover" VBDs. This script can be used to detect possible cases in
pools. Sadly, there is no way to automatically distinguish a VBD that
was created after a VM.revert from a VBD that survived the VM.revert,
so this script relies on the user to determine if the suspicious VBDs are
indeed affected or not.

Therefore, tbis is not a destructive script, it just uses the API to find the
affected VBDs and presents them to the user, as in this example output:

    VM e2678368-596d-1b6e-7211-9ee45f60dec1 ("Alpine minimal for CI") has
    VBDs that are not present in the snapshot it was reverted to
    (303ead66-9515-b1c8-0dc5-d33b7644b161 "Alpine minimal for CI_snapshot1"):
    xvdb (ca8610d2-76e3-6c54-4378-ee599619b4bb))

The script follows this algorithm:

1. Find all VMs that are children of snapshots
   (i.e. were reverted to a particular snapshot at some point in time)
2. Find VBDs that are currently present in such VMs but are
   not present in the snapshot

Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech>
2026-07-13 11:45:35 +00:00