public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 2/2] destroy VM: also check if unused volumes are base images
Date: Mon, 19 Apr 2021 10:46:43 +0200	[thread overview]
Message-ID: <20210419084643.30634-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210419084643.30634-1-f.ebner@proxmox.com>

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@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





  reply	other threads:[~2021-04-19  8:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19  8:46 [pve-devel] [PATCH qemu-server 1/2] destroy VM: always remove (referenced) VM state volumes Fabian Ebner
2021-04-19  8:46 ` Fabian Ebner [this message]
2021-05-28 11:50 ` [pve-devel] applied-series: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210419084643.30634-2-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal