feat: update drive removal logic to first preserve volume data in an unused slot

This commit is contained in:
2025-12-05 04:43:55 -05:00
parent 6f75897266
commit e765a87fa4

View File

@@ -782,14 +782,21 @@ class Storage extends Component
$unusedIndex++;
}
// Move the disk to an unused slot instead of deleting it
// This preserves the volume data
// First, assign the volume to an unused slot to preserve it
$proxmox->request(
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
'put',
[
'unused' . $unusedIndex => $drive['volume'],
'delete' => $driveKey,
]
);
// Then remove the drive configuration (the volume is already safe in unused)
$proxmox->request(
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
'put',
[
$driveKey => 'none',
]
);