fix: validate instance name as DNS label and improve wizard UX
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user