1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 00:16:04 +00:00

fix(vrtManager): a disk in an inactive pool keeps the files it may be made from

Only a running disk's definition has its backing chain; for the others the
in-use check reads it from the volumes of active pools. With such a disk's
overlay in an inactive pool (a stopped VM's, the next start's, a saved
state's or a snapshot's), its backing file counted as unused, so deleting
another VM with its disks, or the volume itself, could delete it. The check
now refuses (InUse) while a disk that is not running and not raw has its
file in an inactive pool, and says to start the pool. A snapshot delete
that is done reports no left-behind files then, rather than failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-11 14:32:46 +03:00
parent effe2a33f0
commit b91daf0525
8 changed files with 413 additions and 338 deletions

View file

@ -2076,8 +2076,9 @@ class wvmInstance(wvmConnect):
an overlay on a snapshot point counts; a disk a revert detached is
kept on purpose, and a file another VM on this host uses (or one
below it) is not reported. A file outside every storage pool is not
checked, nor is anything when the pools could not be refreshed: a
stale pool still lists the removed files."""
checked, nor is anything when the pools could not be refreshed (a
stale pool still lists the removed files) or another VM's files cannot
be read (paths_in_use)."""
disks, own, points = before
if not self._refresh_pools_after_snapshot():
return []
@ -2097,7 +2098,10 @@ class wvmInstance(wvmConnect):
if left:
# another VM on this host may use one; their own backing files
# do not keep each other, but a file in use keeps the files below it
in_use = self.paths_in_use(own=left)
try:
in_use = self.paths_in_use(own=left)
except util.InUse:
return []
for path in [path for path in left if path in in_use]:
while (path := self.backing_path(path)) and path not in in_use:
in_use.add(path)