fix: wait for Proxmox resize task before VM start (v1.2.0)

- configure_vm: capture resize UPID and call wait_for_task(120s)
  before returning; prevents lock conflict when VM is started right
  after disk resize
- resize_vm_disk / resize_container_disk (x2): same fix applied
- remove unnecessary restart_vm() after manual QEMU disk resize —
  resize is a storage-layer operation and does not require a reboot;
  the auto-restart was causing a second lock conflict

Fixes: can't lock file '/var/lock/qemu-server/lock-xxx.conf' - got timeout
Fixes: command '/usr/bin/qemu-img resize' failed: got timeout
This commit is contained in:
markmorado
2026-03-16 20:23:06 +01:00
parent bd1777f67b
commit 4ef79112be
15 changed files with 342 additions and 156 deletions

View File

@@ -1014,15 +1014,10 @@ async def resize_vm_disk(
db.commit()
logger.info(f"Updated disk size in database: VM {vmid} -> {size_gb}GB")
# Перезапускаем VM для применения изменений
restart_success = client.restart_vm(node, vmid)
if restart_success:
logger.info(f"VM {vmid} restarted to apply disk resize")
logger.info(f"User {current_user.username} resized disk {disk} of VM {vmid} to {size}")
return JSONResponse(content={
"status": "success",
"message": f"Размер диска {disk} изменен на {size}. VM перезапускается для применения изменений."
"message": f"Размер диска {disk} изменен на {size}. Для применения изменений внутри ОС выполните resize файловой системы."
})
else:
raise HTTPException(status_code=500, detail="Не удалось изменить размер диска")