fix(snapshots): send required node param and add storage-support hint
All checks were successful
Backend Tests / pytest (Python 3.12) (push) Successful in 49s
Deploy to Production / Trigger production update (push) Successful in 9s

useCreateSnapshot omitted the required ?node= query param, so creation
failed with a 422. Pass node through, and add a UI hint plus a clear
error message when the VM storage does not support snapshots.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 23:35:42 +05:00
parent 3cac5f6c2a
commit aa0ea459cd
4 changed files with 53 additions and 7 deletions

View File

@@ -215,12 +215,12 @@ export function useSnapshots(serverId: number, vmid: number, type: string, node:
});
}
export function useCreateSnapshot(serverId: number, vmid: number, type: string) {
export function useCreateSnapshot(serverId: number, vmid: number, type: string, node: string) {
const qc = useQueryClient();
const prefix = type === 'lxc' ? 'container' : 'vm';
return useMutation({
mutationFn: (body: { snapname: string; description?: string; vmstate?: boolean }) =>
apiClient.post(`/proxmox/api/${serverId}/${prefix}/${vmid}/snapshots`, body),
apiClient.post(`/proxmox/api/${serverId}/${prefix}/${vmid}/snapshots?node=${node}`, body),
onSuccess: () => {
qc.invalidateQueries({ queryKey: vmKeys.snapshots(serverId, vmid) });
},