public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH] fix #7828: avoid parsing absolute paths as volume ids
@ 2026-07-21 12:20 Thomas Ellmenreich
  2026-07-21 12:43 ` Daniel Kral
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Ellmenreich @ 2026-07-21 12:20 UTC (permalink / raw)
  To: pve-devel; +Cc: Thomas Ellmenreich

Just like in the case of cdroms, absolute paths to storage drives can be
skipped when beeing marked as unused as they cannot be owned by the vm.

Signed-off-by: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
---
I'm not 100% sure that I have understood the procedure of registering
unused drives correctly, but skipping this branch in the case of an
absolute path as 'volid' seems to be the correct action.

Alternatively, placing the condition next to the `storage_config` check
could make sense, but would just achieve the same thing, as the
subsequent ownership check will never succeed with an absolute path.

 src/PVE/QemuServer.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 191ae549..782d2e7b 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -1570,12 +1570,14 @@ sub vm_is_volid_owner {
 sub vmconfig_register_unused_drive {
     my ($storecfg, $vmid, $conf, $drive) = @_;
 
+    my $volid = $drive->{file};
+
     if (drive_is_cloudinit($drive)) {
-        eval { PVE::Storage::vdisk_free($storecfg, $drive->{file}) };
+        eval { PVE::Storage::vdisk_free($storecfg, $volid) };
         warn $@ if $@;
         delete $conf->{'special-sections'}->{cloudinit};
-    } elsif (!drive_is_cdrom($drive)) {
-        my $volid = $drive->{file};
+    } elsif (!drive_is_cdrom($drive) && $volid !~ m|^/|) {
+
         my ($storeid, undef) = PVE::Storage::parse_volume_id($volid);
         if (PVE::Storage::storage_config($storecfg, $storeid, 1)) {
             if (vm_is_volid_owner($storecfg, $vmid, $volid)) {
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-21 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 12:20 [PATCH] fix #7828: avoid parsing absolute paths as volume ids Thomas Ellmenreich
2026-07-21 12:43 ` Daniel Kral

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