f-41: subnet: export du préfixe dans la VRF, suppression refusée tant qu'une VM l'utilise #41

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-11 20:28:16 +02:00
commit fe27d45262
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
12 changed files with 253 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import (
"git.g3e.fr/syonad/two/internal/netif"
"git.g3e.fr/syonad/two/internal/netns"
"git.g3e.fr/syonad/two/internal/state"
"git.g3e.fr/syonad/two/internal/vpc"
"github.com/dgraph-io/badger/v4"
)
@ -37,6 +38,12 @@ func CreateSubnet(db *badger.DB, subnetName string, cfg *configuration.Config) e
return err
}
if d.mode == ModeVxlan {
if err := vpc.ExportRoute(db, d.vpc, d.cidr); err != nil {
return err
}
}
return state.Set(db, "subnet/"+subnetName, state.Running)
}