From bb65c2242412e579c65b81d923086d99c0a7a327 Mon Sep 17 00:00:00 2001 From: Jaime <56997708+jaimecb@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:21:29 +0100 Subject: [PATCH] F #6782 Extend GOCA OSVec struct (#3301) Signed-off-by: Jaime --- src/oca/go/src/goca/dynamic/dyntemplate.go | 2 ++ .../go/src/goca/schemas/vm/keys/template.go | 24 +++++++++++-------- src/oca/go/src/goca/schemas/vm/template.go | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/oca/go/src/goca/dynamic/dyntemplate.go b/src/oca/go/src/goca/dynamic/dyntemplate.go index b9c587ce5d8..3405b912e70 100644 --- a/src/oca/go/src/goca/dynamic/dyntemplate.go +++ b/src/oca/go/src/goca/dynamic/dyntemplate.go @@ -403,6 +403,8 @@ func MakePair(key string, v interface{}) (*Pair, error) { val = fmt.Sprintf("%f", v) case int, uint: val = fmt.Sprintf("%d", v) + case bool: + val = strconv.FormatBool(v) case string: val = v } diff --git a/src/oca/go/src/goca/schemas/vm/keys/template.go b/src/oca/go/src/goca/schemas/vm/keys/template.go index f3341fa945f..64f71964a6e 100644 --- a/src/oca/go/src/goca/schemas/vm/keys/template.go +++ b/src/oca/go/src/goca/schemas/vm/keys/template.go @@ -51,16 +51,20 @@ type OS string const ( OSVec string = "OS" - Arch OS = "ARCH" - Machine OS = "MACHINE" - Kernel OS = "KERNEL" - KernelDS OS = "KERNEL_DS" - Initrd OS = "INITRD" - InitrdDS OS = "INITRD_DS" - Root OS = "ROOT" - KernelCmd OS = "KERNEL_CMD" - Bootloader OS = "BOOTLOADER" - Boot OS = "BOOT" + Arch OS = "ARCH" + Machine OS = "MACHINE" + Kernel OS = "KERNEL" + KernelDS OS = "KERNEL_DS" + Initrd OS = "INITRD" + InitrdDS OS = "INITRD_DS" + Root OS = "ROOT" + KernelCmd OS = "KERNEL_CMD" + Bootloader OS = "BOOTLOADER" + Boot OS = "BOOT" + SDDiskBus OS = "SD_DISK_BUS" + UUID OS = "UUID" + Firmware OS = "FIRMWARE" + FirmwareSecure OS = "FIRMWARE_SECURE" ) // CPUModel define keys for the VM CPU model diff --git a/src/oca/go/src/goca/schemas/vm/template.go b/src/oca/go/src/goca/schemas/vm/template.go index 8acd664edfc..50d38972ec2 100644 --- a/src/oca/go/src/goca/schemas/vm/template.go +++ b/src/oca/go/src/goca/schemas/vm/template.go @@ -187,7 +187,7 @@ func (t *Template) GetShowback(key keys.Showback) (string, error) { // OS template part -func (t *Template) AddOS(key keys.OS, value string) error { +func (t *Template) AddOS(key keys.OS, value interface{}) error { return t.Template.AddPairToVec(keys.OSVec, string(key), value) }