diff --git a/extensions/Servers/Proxmox/Livewire/Storage.php b/extensions/Servers/Proxmox/Livewire/Storage.php index 69d1ea34b..d05792aaa 100644 --- a/extensions/Servers/Proxmox/Livewire/Storage.php +++ b/extensions/Servers/Proxmox/Livewire/Storage.php @@ -1023,7 +1023,7 @@ class Storage extends Component $diskConfig = implode(',', $configParts); - // First, set the disk on the new bus + // First, set the disk on the new bus (this attaches the volume) $proxmox->request( '/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config', 'put', @@ -1032,14 +1032,19 @@ class Storage extends Component ] ); - // Then clear the unused slot (set to empty/none to remove the reference without deleting volume) - $proxmox->request( - '/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config', - 'put', - [ - $this->reattachingDriveKey => '', - ] - ); + // Then remove the unused entry using delete parameter + // This is safe because the volume is now attached to the new bus + try { + $proxmox->request( + '/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config', + 'put', + [ + 'delete' => $this->reattachingDriveKey, + ] + ); + } catch (\Exception $e) { + // Unused entry might already be cleaned up automatically, ignore this error + } $this->notify("Drive reattached as {$targetKey} successfully.", 'success'); $this->closeReattachModal();