Skip to content

Commit

Permalink
Add secondary IOL NVRAM bind. (#2263)
Browse files Browse the repository at this point in the history
* Add second IOL NVRAM bind

* Change nvram file paths and iol workdir to consts
  • Loading branch information
kaelemc authored Oct 26, 2024
1 parent 62ac66d commit 5948957
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions nodes/iol/iol.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import (
const (
typeIOL = "iol"
typeL2 = "l2"

iol_workdir = "/iol"
nvram_file1 = "nvram_00001"
nvram_file2 = "nvram_00003"
)

var (
Expand Down Expand Up @@ -95,7 +99,8 @@ func (n *iol) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

n.Cfg.Binds = append(n.Cfg.Binds,
// mount nvram so that config persists
fmt.Sprint(path.Join(n.Cfg.LabDir, "nvram"), ":/iol/nvram_00001"),
fmt.Sprint(path.Join(n.Cfg.LabDir, nvram_file1), ":", path.Join(iol_workdir, nvram_file1)),
fmt.Sprint(path.Join(n.Cfg.LabDir, nvram_file2), ":", path.Join(iol_workdir, nvram_file2)),

// mount launch config
fmt.Sprint(filepath.Join(n.Cfg.LabDir, "startup.cfg"), ":/iol/config.txt"),
Expand Down Expand Up @@ -132,9 +137,14 @@ func (n *iol) PostDeploy(ctx context.Context, params *nodes.PostDeployParams) er
func (n *iol) CreateIOLFiles(ctx context.Context) error {
// If NVRAM already exists, don't need to create
// otherwise saved configs in NVRAM are overwritten.
if !utils.FileExists(path.Join(n.Cfg.LabDir, "nvram")) {
if !utils.FileExists(path.Join(n.Cfg.LabDir, nvram_file1)) {
// create nvram file
utils.CreateFile(path.Join(n.Cfg.LabDir, nvram_file1), "")
}

if !utils.FileExists(path.Join(n.Cfg.LabDir, nvram_file2)) {
// create nvram file
utils.CreateFile(path.Join(n.Cfg.LabDir, "nvram"), "")
utils.CreateFile(path.Join(n.Cfg.LabDir, nvram_file2), "")
}

// create these files so the bind monut doesn't automatically
Expand Down

0 comments on commit 5948957

Please sign in to comment.