feat: improve unused drive handling by retrieving exact disk value before reattachment

This commit is contained in:
2025-12-05 04:37:52 -05:00
parent 77ac1b1a4f
commit edc9605191

View File

@@ -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';