public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
Subject: [PATCH qemu-server 3/3] removed some unnecessary undef checks.
Date: Mon,  3 Aug 2026 14:12:59 +0200	[thread overview]
Message-ID: <20260803121300.138287-4-t.ellmenreich@proxmox.com> (raw)
In-Reply-To: <20260803121300.138287-1-t.ellmenreich@proxmox.com>

Signed-off-by: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
---
 src/PVE/QemuServer.pm | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 0e998cbe..3141b298 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -1818,11 +1818,10 @@ sub destroy_vm {
             { include_unused => 1 },
             sub {
                 my ($ds, $drive) = @_;
-                return if drive_is_cdrom($drive);
 
-                my $volid = $drive->{file};
-                return if !$volid || drive_has_absolute_path($drive);
+                return if drive_is_cdrom($drive) || drive_has_absolute_path($drive);
 
+                my $volid = $drive->{file};
                 my $result = eval { PVE::Storage::volume_is_base_and_used($storecfg, $volid) };
                 # early check, removal of volume will fail later anyway, so warning here is fine
                 log_warn("failed to check if volume '$volid' is used by linked clones: $@")
@@ -1839,8 +1838,7 @@ sub destroy_vm {
         return if drive_is_cdrom($drive, 1);
 
         my $volid = $drive->{file};
-        return if !$volid || drive_has_absolute_path($drive);
-        return if $volids->{$volid};
+        return if drive_has_absolute_path($drive) || $volids->{$volid};
 
         my ($path, $owner) = eval { PVE::Storage::path($storecfg, $volid) };
         log_warn("failed to get path and owner of volume '$volid': $@") if $@;
@@ -6510,11 +6508,9 @@ my $restore_cleanup_oldconf = sub {
         sub {
             my ($ds, $drive) = @_;
 
-            return if drive_is_cdrom($drive, 1);
+            return if drive_is_cdrom($drive, 1) || drive_has_absolute_path($drive);
 
             my $volid = $drive->{file};
-            return if !$volid || drive_has_absolute_path($drive);
-
             my ($path, $owner) = PVE::Storage::path($storecfg, $volid);
             return if !$path || !$owner || ($owner != $vmid);
 
-- 
2.47.3





  parent reply	other threads:[~2026-08-03 12:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 12:12 [PATCH qemu-server 0/3] refactor of volume_id classification Thomas Ellmenreich
2026-08-03 12:12 ` [PATCH qemu-server 1/3] moved verify_volume_id_or_* format registrations Thomas Ellmenreich
2026-08-04 14:09   ` Elias Huhsovitz
2026-08-03 12:12 ` [PATCH qemu-server 2/3] add new classify_drive_file utility Thomas Ellmenreich
2026-08-04 14:23   ` Elias Huhsovitz
2026-08-03 12:12 ` Thomas Ellmenreich [this message]
2026-08-05  8:24   ` [PATCH qemu-server 3/3] removed some unnecessary undef checks Elias Huhsovitz
2026-08-05  9:55     ` Fiona Ebner
2026-08-05  8:22 ` superseded: [PATCH qemu-server 0/3] refactor of volume_id classification Thomas Ellmenreich

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=20260803121300.138287-4-t.ellmenreich@proxmox.com \
    --to=t.ellmenreich@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