[pve-devel] [PATCH qemu-server 2/2] destroy VM: also check if unused volumes are base images

Fabian Ebner f.ebner at proxmox.com
Mon Apr 19 10:46:43 CEST 2021


It's arguably not likely in practice that only an unused volume is still in use
as a base image, but do it for completeness sake.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1af2b53..dce1193 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2127,7 +2127,7 @@ sub destroy_vm {
 
     if ($conf->{template}) {
 	# check if any base image is still used by a linked clone
-	PVE::QemuConfig->foreach_volume($conf, sub {
+	PVE::QemuConfig->foreach_volume_full($conf, { include_unused => 1 }, sub {
 		my ($ds, $drive) = @_;
 		return if drive_is_cdrom($drive);
 
-- 
2.20.1






More information about the pve-devel mailing list