Commit graph

17 commits

Author SHA1 Message Date
ae53d2fbd8 fix: disk resize now opt-in — pre-filled with current size, disabled by default, checkbox to enable
- Backend: None = keep current size (no auto-shrink); only resize when value explicitly provided
- Frontend: Target Disk Size field shows detected size, disabled (not submitted)
- Checkbox 'Enable disk resize' unlocks the field for editing
2026-07-27 08:57:58 +00:00
f1978008bd fix: use relative paths for STAGING_ROOT and LOG_DIR so backend works on host regardless of install location 2026-07-25 17:50:13 +00:00
b33ab1605e fix: auto-cleanup staging files to minimize disk usage
Deletes intermediate files as conversion progresses:
- Archive (.7z/.zip) after extraction
- Source VMDK after qemu-img convert
- Local QCOW2 after qm disk import

Reduces peak storage from zip+VMDK+QCOW2 to just the largest
single file — critical for the 94 GB rootfs with 87 GB images.
2026-07-24 10:06:12 +00:00
cd8d86a98c fix: auto-shrink to 10% of virtual size, min 20 GB
Replaces flat 30 GB default with proportional sizing:
- 500 GB → 50 GB, 200 GB → 20 GB, 80 GB → 20 GB
- Less aggressive for large disks, safer for GRUB boot
- Update UI hint and README to reflect new rule
2026-07-23 12:45:32 +00:00
6db69f434c fix: Clean Up now deletes entire session directory tmp/{guid}/
- Backend cleanup_staging accepts session_id, deletes whole
  STAGING_ROOT/{guid}/ dir when provided
- CleanupRequest model gets session_id field
- Frontend cleanup proxy passes session_id from body
- api_client passes session_id to backend
- reuseImage JS includes session_id in cleanup payload
2026-07-23 10:54:42 +00:00
90bf8e4842 fix: remove unused out_dir from submit_job + Copy flow uses legacy fallback
1. submit_job() was creating empty tmp/out/{vmid}/ dirs via the old
   flat STAGING_OUT path. Removed — _process_job handles this via
   _staging_out() in the session-aware path.

2. Copy (re-convert) flow was hardcoding boot_type=uefi. Now uses
   auto_detect_boot=true with boot_type=legacy as fallback, matching
   the behavior of the original analyze→convert flow.
2026-07-23 10:52:20 +00:00
7a024ca166 fix: correct staging path resolution — tmp/{guid}/in not tmp/in/{guid}
Frontend now passes '{guid}/in/filename' to backend.
Backend extract_if_needed uses STAGING_ROOT (tmp/) as base.
Provisioner staging helpers build tmp/{guid}/in + tmp/{guid}/out.
2026-07-23 10:14:19 +00:00
a28e2af674 refactor: move staging to /mnt/converter/tmp/{guid}/in + out 2026-07-23 10:07:57 +00:00
e53d05f7dc fix: add missing _staging_in helper + STAGING_IN constant 2026-07-23 09:36:50 +00:00
63659e4f93 feat: session GUID isolation for multi-user support
Each browser gets a UUID stored in localStorage, set as a cookie,
and attached to every API call. Files go to session-specific dirs:

  /mnt/converter/in/{guid}/    — uploads, downloads, SCP pulls
  /mnt/converter/out/{guid}/   — converted QCOW2s

Changes:
- base.html: generates UUID via crypto.randomUUID(), stores in
  localStorage + cookie, exposes as window.VM_BENCH_SID
- Frontend: all endpoints accept session_id, _staging() helper
  creates session-aware paths on demand
- JavaScript: session_id appended to all FormData, set as
  X-Session-ID header on raw uploads
- Backend models: JobSubmissionRequest.session_id field added
- Provisioner: _staging_in/_staging_out helpers, source path
  resolution uses session-aware directory
- Converter: extract_if_needed skips re-extraction if dir exists
2026-07-23 09:32:16 +00:00
9eb0f15261 feat: Clone (qm clone) + Copy (re-convert) buttons on completion
After conversion completes, the user sees a form with VM Name and ID
prefilled, and three buttons:

- Clone (instant): qm clone --full via backend, takes seconds
- Copy (re-convert): shows CPU/RAM/Disk fields, re-runs full pipeline
- Clean Up & Finish: deletes staging, returns to start page

Backend: new /api/v1/clone endpoint → provisioner.clone_vm()
Frontend: new /session/clone proxy, api_client.clone_vm()
2026-07-23 09:02:57 +00:00
7e1303a217 fix: auto-detect BIOS boot type + simplified reuse form
1. BIOS: provisioner now calls detect_efi() on the first disk when
   auto_detect_boot=true. Detects EFI partition via guestfish.
   Falls back to user's boot_type if detection inconclusive.

2. Reuse: 'Create Another VM' now shows an inline form asking only
   for VM Name and ID, reusing the same disk image, format, and
   boot settings from the completed job. No redirect needed.
2026-07-23 08:48:31 +00:00
80c5e2ceda fix: sanitize VM name + use qm disk import (newer Proxmox syntax)
- VM name now sanitized: spaces→hyphens, lowercase, strip invalid chars
- qm importdisk → qm disk import (newer Proxmox VE command)
2026-07-23 08:25:46 +00:00
9a6d2df78b fix: real-time progress during qemu-img convert, smoother percentages
qemu-img convert is the longest step but previously had no progress
updates — bar stuck at 10% until conversion completed.

Now _convert_with_progress() runs qemu-img in background and polls
output file size every 2s, updating progress with GiB done/total.

Progress flow for single disk:
  5% queued → 10% starting → 10-55% converting (real-time)
  → 60% shrinking → 70% creating VM → 75-85% importing
  → 95% configuring → 100% done
2026-07-21 19:14:32 +00:00
affcde7afb fix: provisioner now extracts archives and discovers disks before conversion
The job submission receives the original filename (e.g. Debian_13_VMG.7z)
but qemu-img convert needs the actual VMDK path inside the archive.
Now reuse extract_if_needed() + discover_disk() from converter module
to locate the real disk image before conversion.
2026-07-21 19:11:19 +00:00
56131d6346 feat: real Proxmox VM provisioning — qemu-img, virt-resize, qm commands
Replace stub provisioner with real Proxmox integration:

- qemu-img convert: source → QCOW2 in /mnt/converter/out/{vmid}/
- virt-resize --shrink --resize-force: auto-shrink >30 GiB disks
- qm create: VM with cores, RAM, network, SCSI controller
- qm importdisk: import each QCOW2 into Proxmox storage
- qm set: attach disks, configure boot (OVMF/SeaBIOS), EFI disk, serial
- Auto-destroy existing VM with same ID before recreating
- Background thread execution with in-memory status tracking
- Full logging throughout the conversion pipeline
2026-07-21 19:05:07 +00:00
a8099f504c chore: initial commit — vm-bench frontend + backend 2026-07-21 14:53:29 +00:00