mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-10-21 21:15:41 +02:00
create vm: introduce --{os,arch,runtime} command-line arguments (#422)
* create vm: introduce --{os,arch,runtime} command-line arguments
* v1.VM: prevent unsupported fields for "vetu" runtime
This commit is contained in:
@@ -73,6 +73,10 @@ func (controller *Controller) createVM(ctx *gin.Context) responder.Responder {
|
||||
vm.Runtime = v1.RuntimeTart
|
||||
}
|
||||
|
||||
if err := vm.Validate(); err != nil {
|
||||
return responder.JSON(http.StatusPreconditionFailed, NewErrorResponse("%v", err))
|
||||
}
|
||||
|
||||
// Softnet-specific logic: automatically enable Softnet when NetSoftnetAllow or NetSoftnetBlock are set
|
||||
// and propagate deprecated and non-deprecated boolean fields into each other
|
||||
if vm.NetSoftnetDeprecated || vm.NetSoftnet || len(vm.NetSoftnetAllow) != 0 || len(vm.NetSoftnetBlock) != 0 {
|
||||
@@ -173,6 +177,10 @@ func (controller *Controller) updateVMSpec(ctx *gin.Context) responder.Responder
|
||||
"and \"runtime\" fields cannot be modified"))
|
||||
}
|
||||
|
||||
if err := userVM.Validate(); err != nil {
|
||||
return responder.JSON(http.StatusPreconditionFailed, NewErrorResponse("%v", err))
|
||||
}
|
||||
|
||||
// Softnet-specific logic: automatically enable Softnet when NetSoftnetAllow or NetSoftnetBlock are set
|
||||
// and propagate deprecated and non-deprecated boolean fields into each other
|
||||
if userVM.NetSoftnetDeprecated || userVM.NetSoftnet || len(userVM.NetSoftnetAllow) != 0 || len(userVM.NetSoftnetBlock) != 0 {
|
||||
|
||||
Reference in New Issue
Block a user