Since commit 374f467678, the provider's GetSnapshotProperties()
returns S_OK for any snapshot ID without filling in the properties. VSS
consults every registered provider when a requester looks up a snapshot,
so lookups of snapshots owned by other providers now succeed with an
all-zero VSS_SNAPSHOT_PROP. Backup software relying on it fails, e.g.
Veeam: "Original volume name is not specified for the shadow (shadow
volume id: '{00000000-0000-0000-0000-000000000000}')".
Simply reverting is not an option: 374f467678 switched to S_OK because
returning VSS_E_OBJECT_NOT_FOUND unconditionally broke qemu-ga's own
snapshot sets. The provider must answer for its own snapshots only. It
does not create real shadow copies, but it does take part in the
snapshot set during qemu-ga fsfreeze cycles. Remember the snapshot IDs
received in BeginPrepareSnapshot(), return their required properties,
and return VSS_E_OBJECT_NOT_FOUND for anything else. Fill every required
VSS_SNAPSHOT_PROP member except the exposed name and path, which are
optional. The snapshot device object is an empty string because the
host-side snapshot has no guest-visible device.
Entries are dropped when VSS deletes the snapshots or the set, or when
the set is aborted (AbortSnapshots()).
COM+ may hand out several CQGAVssProvider instances (and serve several
client processes), so this registry is module-global. It is per-process
by design and safe because the COM+ application is hosted by a single NT
service (see CreateServiceForApplication() in install.cpp): COM+ forbids
pooling and recycling for service-hosted applications, so exactly one
surrogate process ever hosts the provider.
On the requester side, the snapshot set is created in the persistent
VSS_CTX_APP_ROLLBACK context, so VSS keeps it after the freeze/thaw
cycle and may keep querying providers about it. The provider registry
does not outlive the cycle (requester_thaw() stops the hosting service,
and the provider process with it), so later queries would get "not
found" for a set VSS still believes exists. Make requester_thaw() delete
the snapshot set explicitly at the end of the cycle, whatever its
outcome (including BackupComplete() failure and aborted snapshot sets).
A failure to delete is only logged, since the guest filesystems have
already been thawed.
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4584
Buglink: https://redhat.atlassian.net/browse/RHEL-250662
Fixes: 374f467678 ("qga: Fix VSS provider GetSnapshotProperties return value")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261027160606.2668607-2-marcandre.lureau@redhat.com
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>