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
This commit is contained in:
parent
778e929985
commit
cd8d86a98c
3 changed files with 14 additions and 8 deletions
|
|
@ -251,10 +251,12 @@ Virtual disk images (VMDK, QCOW2) have two sizes:
|
|||
| **Actual size** | Real data in the image (sparse file) | ~7 GB |
|
||||
|
||||
During analysis, the UI shows the virtual size (e.g. *"500.0 GB detected. Omit to
|
||||
auto-shrink to 30 GB"*). This is because the source image was created with a
|
||||
auto-shrink"*). This is because the source image was created with a
|
||||
large virtual disk, but only a fraction is used.
|
||||
|
||||
**Target Disk Size field — what happens:**
|
||||
**Auto-shrink**: if you leave Target Disk Size blank, the disk shrinks to
|
||||
**10% of its virtual size, minimum 20 GB**. A 500 GB disk becomes 50 GB,
|
||||
an 80 GB disk becomes 20 GB. You can override this by entering a value.
|
||||
|
||||
| You enter | Result |
|
||||
|-----------|--------|
|
||||
|
|
|
|||
|
|
@ -283,11 +283,15 @@ def _process_job(job_id: str, req: JobSubmissionRequest):
|
|||
current_gb = current_bytes / (1024 ** 3)
|
||||
|
||||
target_gb = req.target_disk_size_gb
|
||||
if target_gb is None and current_gb > 30:
|
||||
target_gb = 30
|
||||
logger.info("Auto-shrink: %.1f GiB → %d GiB", current_gb, target_gb)
|
||||
elif target_gb is None:
|
||||
target_gb = int(round(current_gb)) + 1
|
||||
if target_gb is None:
|
||||
# Auto-shrink: 10% of virtual size, minimum 20 GB
|
||||
auto_target = max(int(current_gb * 0.1), 20)
|
||||
if current_gb > auto_target:
|
||||
target_gb = auto_target
|
||||
logger.info("Auto-shrink: %.1f GiB → %d GiB (10%% rule)", current_gb, target_gb)
|
||||
else:
|
||||
target_gb = int(round(current_gb)) + 1
|
||||
logger.info("Disk already <= target, no shrink needed")
|
||||
|
||||
if target_gb < current_gb:
|
||||
_update_job(job_id, progress=60,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
<input type="number" name="target_disk_size_gb" class="pve-input"
|
||||
value="{{ analysis.disk_size_gb }}"
|
||||
placeholder="Leave blank for auto-shrink">
|
||||
<span class="pve-hint">{{ analysis.disk_size_gb }} GB detected. Omit to auto-shrink to 30 GB.</span>
|
||||
<span class="pve-hint">{{ analysis.disk_size_gb }} GB detected. Omit to auto-shrink (10% of size, min 20 GB).</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pve-row">
|
||||
|
|
|
|||
Loading…
Reference in a new issue