feat(instances): ISO eject/mount with boot-order switch and hybrid reboot
Some checks failed
Deploy to Production / Trigger production update (push) Has been cancelled
Backend Tests / pytest (Python 3.12) (push) Has been cancelled

- Images: show real ISO files already on the node storage (incl. those
  present before the node joined the panel) via existing node/isos endpoint
- ISO dialog: rename "detach" to "Eject", show current image inside the
  select (drop overflowing side text), add "boot from disk" checkbox
- Backend: on eject, put disk first in boot order; on mount, optional
  "boot from this ISO" puts CD-ROM first
- Reboot to apply the new boot order via hybrid restart: graceful ACPI
  shutdown with forceStop fallback, then start (fixes guest-ping timeout
  on freshly installed OS without QEMU Guest Agent)
- Update iso_next_steps hint to reflect the automated flow
This commit is contained in:
markmorado
2026-07-24 23:00:32 +05:00
parent aa100b49c1
commit b7c3a6ed35
8 changed files with 311 additions and 37 deletions

View File

@@ -50,6 +50,28 @@ export function useNodeArch(serverId?: number, node?: string) {
});
}
// Реальные ISO-образы, уже лежащие на ISO-хранилищах ноды (в т.ч. загруженные
// до подключения ноды к панели). Отдельно от каталога/зеркал — это содержимое storage.
export interface NodeIso {
volid: string;
storage: string;
size: number | null;
format: string | null;
name: string;
}
export function useNodeIsos(serverId?: number, node?: string) {
return useQuery({
queryKey: ['node-isos', serverId, node],
queryFn: () =>
apiClient.get<{ isos: NodeIso[] }>(
`/proxmox/api/${serverId}/node/${encodeURIComponent(node!)}/isos`,
),
enabled: !!serverId && !!node,
staleTime: 60 * 1000,
});
}
// Целевые хранилища ноды по типу контента (import|vztmpl|iso).
export function useImageStorages(serverId?: number, node?: string, content?: string) {
return useQuery({

View File

@@ -826,22 +826,34 @@ export function useNodeIsos(serverId: number, node: string, enabled = true) {
export function useAttachIso(serverId: number, vmid: number, node: string) {
const qc = useQueryClient();
return useMutation<{ status: string }, Error, { volid: string; device?: string }>({
return useMutation<
{ status: string; boot_from_iso?: boolean; rebooted?: boolean },
Error,
{ volid: string; device?: string; boot_from_iso?: boolean; reboot_after?: boolean }
>({
mutationFn: (body) =>
apiClient.post(`/proxmox/api/${serverId}/vm/${vmid}/iso/attach?node=${node}`, body),
onSuccess: () => {
qc.invalidateQueries({ queryKey: vmKeys.config(serverId, vmid) });
qc.invalidateQueries({ queryKey: vmKeys.status(serverId, vmid) });
qc.invalidateQueries({ queryKey: ['resources'] });
},
});
}
export function useDetachIso(serverId: number, vmid: number, node: string) {
const qc = useQueryClient();
return useMutation<{ status: string }, Error, { device?: string }>({
return useMutation<
{ status: string; boot_from_disk?: boolean; rebooted?: boolean },
Error,
{ device?: string; boot_from_disk?: boolean; reboot_after?: boolean }
>({
mutationFn: (body) =>
apiClient.post(`/proxmox/api/${serverId}/vm/${vmid}/iso/detach?node=${node}`, body || {}),
onSuccess: () => {
qc.invalidateQueries({ queryKey: vmKeys.config(serverId, vmid) });
qc.invalidateQueries({ queryKey: vmKeys.status(serverId, vmid) });
qc.invalidateQueries({ queryKey: ['resources'] });
},
});
}