f-28: api: add uefi params
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
c602725de9
commit
325f1acff5
5 changed files with 15 additions and 0 deletions
|
|
@ -430,6 +430,10 @@ components:
|
||||||
minItems: 1
|
minItems: 1
|
||||||
items:
|
items:
|
||||||
$ref: "#/components/schemas/VMStorage"
|
$ref: "#/components/schemas/VMStorage"
|
||||||
|
uefi:
|
||||||
|
type: boolean
|
||||||
|
description: Boot with UEFI firmware (OVMF). Defaults to false (SeaBIOS).
|
||||||
|
example: false
|
||||||
|
|
||||||
VMInterface:
|
VMInterface:
|
||||||
type: object
|
type: object
|
||||||
|
|
@ -487,6 +491,9 @@ components:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: "#/components/schemas/VMStorage"
|
$ref: "#/components/schemas/VMStorage"
|
||||||
|
uefi:
|
||||||
|
type: boolean
|
||||||
|
example: false
|
||||||
|
|
||||||
Error:
|
Error:
|
||||||
type: object
|
type: object
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ type VMCreateRequest struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Memory int `json:"memory"`
|
Memory int `json:"memory"`
|
||||||
CPUs int `json:"cpus"`
|
CPUs int `json:"cpus"`
|
||||||
|
UEFI bool `json:"uefi"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
SSHKey string `json:"sshkey"`
|
SSHKey string `json:"sshkey"`
|
||||||
Interfaces []VMInterface `json:"interfaces"`
|
Interfaces []VMInterface `json:"interfaces"`
|
||||||
|
|
@ -61,6 +62,7 @@ type VM struct {
|
||||||
MetadataPort string `json:"metadata_port"`
|
MetadataPort string `json:"metadata_port"`
|
||||||
Memory int `json:"memory"`
|
Memory int `json:"memory"`
|
||||||
CPUs int `json:"cpus"`
|
CPUs int `json:"cpus"`
|
||||||
|
UEFI bool `json:"uefi"`
|
||||||
Interfaces []VMInterface `json:"interfaces"`
|
Interfaces []VMInterface `json:"interfaces"`
|
||||||
Storage []VMStorage `json:"storage"`
|
Storage []VMStorage `json:"storage"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ func vmFromDB(name string, entries map[string]string) (VM, error) {
|
||||||
vm.MetadataPort = entries[prefix+"metadata_port"]
|
vm.MetadataPort = entries[prefix+"metadata_port"]
|
||||||
vm.Memory, _ = strconv.Atoi(entries[prefix+"memory"])
|
vm.Memory, _ = strconv.Atoi(entries[prefix+"memory"])
|
||||||
vm.CPUs, _ = strconv.Atoi(entries[prefix+"cpus"])
|
vm.CPUs, _ = strconv.Atoi(entries[prefix+"cpus"])
|
||||||
|
vm.UEFI = entries[prefix+"uefi"] == "true"
|
||||||
|
|
||||||
subnet := entries[prefix+"subnet"]
|
subnet := entries[prefix+"subnet"]
|
||||||
ip := entries[prefix+"ip"]
|
ip := entries[prefix+"ip"]
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ func (s *Server) startVM(w http.ResponseWriter, r *http.Request) {
|
||||||
VolumePath: req.Storage[0].Path,
|
VolumePath: req.Storage[0].Path,
|
||||||
Memory: req.Memory,
|
Memory: req.Memory,
|
||||||
CPUs: req.CPUs,
|
CPUs: req.CPUs,
|
||||||
|
UEFI: req.UEFI,
|
||||||
Password: req.Password,
|
Password: req.Password,
|
||||||
SSHKey: req.SSHKey,
|
SSHKey: req.SSHKey,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ type StartVMCommand struct {
|
||||||
VolumePath string
|
VolumePath string
|
||||||
Memory int
|
Memory int
|
||||||
CPUs int
|
CPUs int
|
||||||
|
UEFI bool
|
||||||
Password string
|
Password string
|
||||||
SSHKey string
|
SSHKey string
|
||||||
}
|
}
|
||||||
|
|
@ -46,6 +47,9 @@ func (c StartVMCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
|
||||||
kv.AddInDB(db, "vm/"+c.Name+"/volume_path", c.VolumePath)
|
kv.AddInDB(db, "vm/"+c.Name+"/volume_path", c.VolumePath)
|
||||||
kv.AddInDB(db, "vm/"+c.Name+"/memory", strconv.Itoa(c.Memory))
|
kv.AddInDB(db, "vm/"+c.Name+"/memory", strconv.Itoa(c.Memory))
|
||||||
kv.AddInDB(db, "vm/"+c.Name+"/cpus", strconv.Itoa(c.CPUs))
|
kv.AddInDB(db, "vm/"+c.Name+"/cpus", strconv.Itoa(c.CPUs))
|
||||||
|
if c.UEFI {
|
||||||
|
kv.AddInDB(db, "vm/"+c.Name+"/uefi", "true")
|
||||||
|
}
|
||||||
if c.Password != "" {
|
if c.Password != "" {
|
||||||
kv.AddInDB(db, "vm/"+c.Name+"/password", c.Password)
|
kv.AddInDB(db, "vm/"+c.Name+"/password", c.Password)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue