Skip to content

Commit 39e58b5

Browse files
committed
Nvidia Bluefield ignition provider
1 parent 29861e8 commit 39e58b5

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright 2025 CoreOS, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package nvidia_bluefield
16+
17+
import (
18+
"os"
19+
20+
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
21+
"github.com/coreos/ignition/v2/internal/platform"
22+
"github.com/coreos/ignition/v2/internal/providers/util"
23+
"github.com/coreos/ignition/v2/internal/resource"
24+
25+
"github.com/coreos/vcontext/report"
26+
)
27+
28+
const (
29+
bootfifoPath = "/sys/bus/platform/devices/MLNXBF04:00/bootfifo"
30+
)
31+
32+
func init() {
33+
platform.Register(platform.Provider{
34+
Name: "nvidia-bluefield",
35+
Fetch: fetchConfig,
36+
})
37+
}
38+
39+
func fetchConfig(f *resource.Fetcher) (cfg types.Config, rpt report.Report, err error) {
40+
data, err := os.ReadFile(bootfifoPath)
41+
if os.IsNotExist(err) {
42+
f.Logger.Info("Nvidia BlueField bootfifo was not found. Ignoring...")
43+
cfg, rpt, err = util.ParseConfig(f.Logger, []byte{})
44+
return
45+
} else if err != nil {
46+
f.Logger.Err("couldn't read Nvidia BlueField config: %v", err)
47+
return
48+
}
49+
50+
if len(data) == 0 {
51+
f.Logger.Info("no config found in Nvidia BlueField bootfifo")
52+
cfg, rpt, err = util.ParseConfig(f.Logger, []byte{})
53+
return
54+
}
55+
56+
cfg, rpt, err = util.ParseConfig(f.Logger, data)
57+
return
58+
}

internal/register/providers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
_ "github.com/coreos/ignition/v2/internal/providers/kubevirt"
3333
_ "github.com/coreos/ignition/v2/internal/providers/metal"
3434
_ "github.com/coreos/ignition/v2/internal/providers/nutanix"
35+
_ "github.com/coreos/ignition/v2/internal/providers/nvidia_bluefield"
3536
_ "github.com/coreos/ignition/v2/internal/providers/openstack"
3637
_ "github.com/coreos/ignition/v2/internal/providers/oraclecloud"
3738
_ "github.com/coreos/ignition/v2/internal/providers/packet"

0 commit comments

Comments
 (0)