f-34: metadata: add metadata in dispatcher #34

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-08-24 22:19:46 +02:00
commit ae81158b2d
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
5 changed files with 221 additions and 15 deletions

View file

@ -20,15 +20,16 @@ type VMDisk struct {
}
type StartVMCommand struct {
Name string
Subnet string
IP string
Disks []VMDisk
Memory int
CPUs int
UEFI bool
Password string
SSHKey string
Name string
Subnet string
IP string
Disks []VMDisk
Memory int
CPUs int
UEFI bool
Password string
SSHKey string
Documents map[string]string
}
func (c StartVMCommand) Key() string { return "vm/" + c.Name }
@ -66,6 +67,11 @@ func (c StartVMCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
if c.SSHKey != "" {
kv.AddInDB(db, "vm/"+c.Name+"/sshkey", c.SSHKey)
}
for doc, content := range c.Documents {
if err := kv.AddInDB(db, "vm/"+c.Name+"/metadata/"+doc, content); err != nil {
return fmt.Errorf("store metadata %s: %w", doc, err)
}
}
return nil
}