mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 03:36:48 +00:00
fix(instances): a snapshot file another VM uses is not called left behind
After a snapshot revert or delete, files libvirt could not remove are named in a warning that says nothing uses them and asks to remove them by hand. A file another VM on the same host uses (as a disk, a backing file or a snapshot file) is no longer named: removing it would break that VM. The warning now says no VM on this host uses the files.
This commit is contained in:
parent
c970f8e853
commit
097a91592c
3 changed files with 32 additions and 5 deletions
|
|
@ -1715,9 +1715,10 @@ class wvmInstance(wvmConnect):
|
|||
logs a warning then (on NFS it removes them as the qemu user, who
|
||||
needs write access to their directory). Only a snapshot's own file or
|
||||
an overlay on a snapshot point counts; a disk a revert detached is
|
||||
kept on purpose. 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."""
|
||||
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."""
|
||||
disks, own, points = before
|
||||
if not self._refresh_pools_after_snapshot():
|
||||
return []
|
||||
|
|
@ -1734,6 +1735,14 @@ class wvmInstance(wvmConnect):
|
|||
except libvirtError: # not in a pool, or removed meanwhile
|
||||
continue
|
||||
left.append(path)
|
||||
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)
|
||||
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)
|
||||
left = [path for path in left if path not in in_use]
|
||||
return left
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue