f-88: api: nom obligatoire des interfaces de VM, migration nic-<i> #88
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
8e144817c5
commit
6ecac451ee
15 changed files with 244 additions and 25 deletions
|
|
@ -22,6 +22,7 @@ type VMDisk struct {
|
|||
}
|
||||
|
||||
type VMNIC struct {
|
||||
Name string
|
||||
Subnet string
|
||||
IP string
|
||||
MAC string
|
||||
|
|
@ -57,6 +58,9 @@ func (c StartVMCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
|
|||
state.Set(db, c.Key(), state.Creating)
|
||||
for i, n := range c.NICs {
|
||||
prefix := fmt.Sprintf("vm/%s/nic/%d/", c.Name, i)
|
||||
if err := kv.AddInDB(db, prefix+"name", n.Name); err != nil {
|
||||
return fmt.Errorf("store nic %d name: %w", i, err)
|
||||
}
|
||||
if err := kv.AddInDB(db, prefix+"subnet", n.Subnet); err != nil {
|
||||
return fmt.Errorf("store nic %d subnet: %w", i, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue