From edc960519107fc6c2f560e9a03608c7dc655fe1e Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Fri, 5 Dec 2025 04:37:52 -0500 Subject: [PATCH] feat: improve unused drive handling by retrieving exact disk value before reattachment --- extensions/Servers/Proxmox/Livewire/Storage.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/extensions/Servers/Proxmox/Livewire/Storage.php b/extensions/Servers/Proxmox/Livewire/Storage.php index ce529999e..965d4248c 100644 --- a/extensions/Servers/Proxmox/Livewire/Storage.php +++ b/extensions/Servers/Proxmox/Livewire/Storage.php @@ -973,8 +973,20 @@ class Storage extends Component try { $proxmox = new Proxmox; - // Build the disk configuration - $configParts = [$unusedDrive['volume']]; + // First, get the current config to retrieve the exact unused disk value + $config = $proxmox->request( + '/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config' + ); + + $unusedValue = $config['data'][$this->reattachingDriveKey] ?? null; + if (!$unusedValue) { + $this->notify('Unused drive no longer exists. Please refresh the page.', 'error'); + $this->loadStorageConfiguration(false); + return; + } + + // Build the disk configuration using the exact volume from the unused entry + $configParts = [$unusedValue]; // Add default settings for the bus type $configParts[] = 'cache=none';