Allow creating VMs with implicit CPU and memory (#243)

* Allow creating VMs with implicit CPU and memory

* Clarify why cpu/memory can be 0 a bit better

* Controller(API): don't forget to update DefaultCPU and DefaultMemory

* Add an integration test for implicit CPU and memory
This commit is contained in:
Nikolay Edigaryev
2025-02-06 00:50:01 +04:00
committed by GitHub
parent 6b3d64be96
commit 581de320b9
10 changed files with 150 additions and 12 deletions
-6
View File
@@ -34,12 +34,6 @@ func (controller *Controller) createVM(ctx *gin.Context) responder.Responder {
if vm.Image == "" {
return responder.JSON(http.StatusPreconditionFailed, NewErrorResponse("VM image is empty"))
}
if vm.CPU == 0 {
return responder.JSON(http.StatusPreconditionFailed, NewErrorResponse("VM CPU is zero"))
}
if vm.Memory == 0 {
return responder.JSON(http.StatusPreconditionFailed, NewErrorResponse("VM memory is zero"))
}
vm.Status = v1.VMStatusPending
vm.CreatedAt = time.Now()