[pve-devel] [PATCH qemu-server v6 3/3] mark volumes pending detach as unused if storage was removed
Michael Köppl
m.koeppl at proxmox.com
Tue May 20 11:08:18 CEST 2025
If the storage backing the volume was removed, the volume will be marked
as unused when pending actions are processed (e.g. volume was detached).
Previously, the volume would simply disappear from the config.
Co-authored-by: Stefan Hrdlicka
Signed-off-by: Michael Köppl <m.koeppl at proxmox.com>
---
PVE/QemuServer.pm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 68bbf4ce..d47fa51c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1838,7 +1838,11 @@ sub vmconfig_register_unused_drive {
delete $conf->{'special-sections'}->{cloudinit};
} elsif (!drive_is_cdrom($drive)) {
my $volid = $drive->{file};
- if (vm_is_volid_owner($storecfg, $vmid, $volid)) {
+ my ($storeid, undef) = PVE::Storage::parse_volume_id($volid);
+ if (
+ !PVE::Storage::storage_config($storecfg, $storeid, 1)
+ || vm_is_volid_owner($storecfg, $vmid, $volid)
+ ) {
PVE::QemuConfig->add_unused_volume($conf, $volid, $vmid);
}
}
--
2.39.5
More information about the pve-devel
mailing list