fix: validate instance name as DNS label and improve wizard UX
Some checks failed
Backend Tests / pytest (Python 3.12) (push) Failing after 1m23s
Deploy to Production / Trigger production update (push) Failing after 10s

Add DNS name validation (RFC 952/1123) for VM, LXC and ISO instance
names on both backend and frontend. Proxmox rejects names with
underscores or special characters but the error was only surfaced as
a raw 400 from the API.

Also require Cloud-Init user and password fields for VM deploys
(highlighted when empty, Next button blocked), and fix numeric input
fields that showed "0" on clear and concatenated values like "04096".
This commit is contained in:
2026-08-17 16:24:55 +05:00
parent 0220f338db
commit 8cbba05dac
7 changed files with 117 additions and 26 deletions

View File

@@ -1072,6 +1072,12 @@ async def deploy_vm_from_template(
raise HTTPException(status_code=404, detail="Owner user not found")
instance_owner_id = owner.id
from ..schemas import validate_instance_name
try:
deploy_data.name = validate_instance_name(deploy_data.name)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
# Enforce per-user resource quota (no-op if owner has no quota set)
from ..services.quota_service import check_quota
check_quota(db, instance_owner_id, add_cores=cores, add_memory_mb=memory, add_disk_gb=disk)