fix(backend): restore operations — add force param, fix QEMU restore API
Some checks failed
Backend Tests / pytest (Python 3.12) (push) Failing after 47s

- restore_vm/restore_lxc: add force=True param (needed for in-place overwrite)
- QEMU restore: remove `restore: 1` from params (breaks Proxmox API — restore
  is triggered by archive presence alone, unlike LXC where restore: 1 required).
  This fixes both single and bulk QEMU restores.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-13 16:32:23 +05:00
parent 82a6e0e24a
commit 2e8558fa51
4 changed files with 344 additions and 5 deletions

View File

@@ -65,6 +65,24 @@ export function useRestoreBackup() {
});
}
export type BulkRestoreItem = { node: string; vmid: number; archive: string; vm_type: string };
export type BulkRestoreResult = {
success: boolean;
total: number;
succeeded: number;
failed: number;
results: { vmid: number; target_vmid?: number; archive: string; success: boolean; upid?: string; error?: string }[];
};
export function useBulkRestoreBackup() {
const qc = useQueryClient();
return useMutation({
mutationFn: (data: { server_id: number; storage: string; mode: 'in_place' | 'new_vmid'; start: boolean; items: BulkRestoreItem[] }) =>
apiClient.post<BulkRestoreResult>('/proxmox/api/backups/restore-bulk', data),
onSuccess: () => qc.invalidateQueries({ queryKey: ['backups'] }),
});
}
export type BackupJobInput = {
server_id: number;
node: string;