diff --git a/api/resource/definitions/hardware/hardware.proto b/api/resource/definitions/hardware/hardware.proto
index e1955afd61..e45aabe140 100755
--- a/api/resource/definitions/hardware/hardware.proto
+++ b/api/resource/definitions/hardware/hardware.proto
@@ -16,6 +16,18 @@ message MemoryModuleSpec {
string product_name = 8;
}
+// PCIDeviceSpec represents a single processor.
+message PCIDeviceSpec {
+ string class = 1;
+ string subclass = 2;
+ string vendor = 3;
+ string product = 4;
+ string class_id = 5;
+ string subclass_id = 6;
+ string vendor_id = 7;
+ string product_id = 8;
+}
+
// ProcessorSpec represents a single processor.
message ProcessorSpec {
string socket = 1;
diff --git a/go.mod b/go.mod
index 15d965cd3d..fbeaee74a7 100644
--- a/go.mod
+++ b/go.mod
@@ -137,7 +137,7 @@ require (
github.com/siderolabs/go-kubeconfig v0.1.0
github.com/siderolabs/go-kubernetes v0.2.9
github.com/siderolabs/go-loadbalancer v0.3.3
- github.com/siderolabs/go-pcidb v0.2.0
+ github.com/siderolabs/go-pcidb v0.3.0
github.com/siderolabs/go-pointer v1.0.0
github.com/siderolabs/go-procfs v0.1.2
github.com/siderolabs/go-retry v0.3.3
diff --git a/go.sum b/go.sum
index 1db4f907d0..d341007dd4 100644
--- a/go.sum
+++ b/go.sum
@@ -678,8 +678,8 @@ github.com/siderolabs/go-kubernetes v0.2.9 h1:EtaOcni9P0etJz+UDlIKQkgsTjCg2MWI2p
github.com/siderolabs/go-kubernetes v0.2.9/go.mod h1:AAydnLZrqG+MJrKTa82AszkWIytkqwDBt7PL+bfbupI=
github.com/siderolabs/go-loadbalancer v0.3.3 h1:D6ONnP9Erlh4TS6kV9L7ocnfrNYCA/58i6ZF0QweLJk=
github.com/siderolabs/go-loadbalancer v0.3.3/go.mod h1:7j4Q9peU/UFuTNSFfwhKLQ028CNkyMkAdGnSi1Dm7Jw=
-github.com/siderolabs/go-pcidb v0.2.0 h1:ZCkF1cz6UjoEIHpP7+aeTI5BwmSxE627Jl1Wy2VZAwU=
-github.com/siderolabs/go-pcidb v0.2.0/go.mod h1:XstZrp8xnganxzIc3UQKfCs1fQFgYWH2lqtWeqBwRok=
+github.com/siderolabs/go-pcidb v0.3.0 h1:jR4w1YLNY8Cv1o5jnoQ2Q+pbxcosO2FVFrAAp1RURnw=
+github.com/siderolabs/go-pcidb v0.3.0/go.mod h1:4XYdmnR/o9kSzMe8dKK17wLBhPNIsisjqmU3QD1FjRk=
github.com/siderolabs/go-pointer v1.0.0 h1:6TshPKep2doDQJAAtHUuHWXbca8ZfyRySjSBT/4GsMU=
github.com/siderolabs/go-pointer v1.0.0/go.mod h1:HTRFUNYa3R+k0FFKNv11zgkaCLzEkWVzoYZ433P3kHc=
github.com/siderolabs/go-procfs v0.1.2 h1:bDs9hHyYGE2HO1frpmUsD60yg80VIEDrx31fkbi4C8M=
diff --git a/hack/release.toml b/hack/release.toml
index 1a1503c202..e6568b3998 100644
--- a/hack/release.toml
+++ b/hack/release.toml
@@ -49,6 +49,12 @@ machine:
```
Please note that on running cluster you will have to kill CoreDNS pods for this change to apply.
+"""
+
+ [notes.lspci]
+ title = "PCI Devices"
+ description = """\
+A list of PCI devices can now be obtained via `PCIDevices` resource, e.g. `talosctl get pcidevices`.
"""
[make_deps]
diff --git a/internal/app/machined/pkg/controllers/hardware/pcidevices.go b/internal/app/machined/pkg/controllers/hardware/pcidevices.go
new file mode 100644
index 0000000000..847e31750b
--- /dev/null
+++ b/internal/app/machined/pkg/controllers/hardware/pcidevices.go
@@ -0,0 +1,138 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+package hardware
+
+import (
+ "bytes"
+ "context"
+ "fmt"
+ "os"
+ "path/filepath"
+ "strconv"
+
+ "github.com/cosi-project/runtime/pkg/controller"
+ "github.com/cosi-project/runtime/pkg/safe"
+ "github.com/siderolabs/go-pcidb/pkg/pcidb"
+ "go.uber.org/zap"
+
+ runtimetalos "github.com/siderolabs/talos/internal/app/machined/pkg/runtime"
+ "github.com/siderolabs/talos/pkg/machinery/resources/hardware"
+)
+
+// PCIDevicesController populates PCI device information.
+type PCIDevicesController struct {
+ V1Alpha1Mode runtimetalos.Mode
+}
+
+// Name implements controller.Controller interface.
+func (ctrl *PCIDevicesController) Name() string {
+ return "hardware.PCIDevicesController"
+}
+
+// Inputs implements controller.Controller interface.
+func (ctrl *PCIDevicesController) Inputs() []controller.Input {
+ return nil
+}
+
+// Outputs implements controller.Controller interface.
+func (ctrl *PCIDevicesController) Outputs() []controller.Output {
+ return []controller.Output{
+ {
+ Type: hardware.PCIDeviceType,
+ Kind: controller.OutputExclusive,
+ },
+ }
+}
+
+// Run implements controller.Controller interface.
+//
+//nolint:gocyclo
+func (ctrl *PCIDevicesController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error {
+ // PCI device info doesn't make sense inside a container, so skip the controller
+ if ctrl.V1Alpha1Mode == runtimetalos.ModeContainer {
+ return nil
+ }
+
+ // [TODO]: a single run for now, need to figure out how to trigger rescan
+ for {
+ select {
+ case <-ctx.Done():
+ return nil
+ case <-r.EventCh():
+ }
+
+ deviceIDs, err := os.ReadDir("/sys/bus/pci/devices")
+ if err != nil {
+ return fmt.Errorf("error scanning devices: %w", err)
+ }
+
+ logger.Debug("found PCI devices", zap.Int("count", len(deviceIDs)))
+
+ r.StartTrackingOutputs()
+
+ for _, deviceID := range deviceIDs {
+ class, err := readHexPCIInfo(deviceID.Name(), "class")
+ if err != nil {
+ if os.IsNotExist(err) {
+ continue
+ }
+
+ return fmt.Errorf("error parsing device %s class: %w", deviceID.Name(), err)
+ }
+
+ vendor, err := readHexPCIInfo(deviceID.Name(), "vendor")
+ if err != nil {
+ if os.IsNotExist(err) {
+ continue
+ }
+
+ return fmt.Errorf("error parsing device %s vendor: %w", deviceID.Name(), err)
+ }
+
+ product, err := readHexPCIInfo(deviceID.Name(), "device")
+ if err != nil {
+ if os.IsNotExist(err) {
+ continue
+ }
+
+ return fmt.Errorf("error parsing device %s product: %w", deviceID.Name(), err)
+ }
+
+ classID := pcidb.Class((class >> 16) & 0xff)
+ subclassID := pcidb.Subclass((class >> 8) & 0xff)
+ vendorID := pcidb.Vendor(vendor)
+ productID := pcidb.Product(product)
+
+ if err := safe.WriterModify(ctx, r, hardware.NewPCIDeviceInfo(deviceID.Name()), func(r *hardware.PCIDevice) error {
+ r.TypedSpec().ClassID = fmt.Sprintf("0x%02x", classID)
+ r.TypedSpec().SubclassID = fmt.Sprintf("0x%02x", subclassID)
+ r.TypedSpec().VendorID = fmt.Sprintf("0x%04x", vendorID)
+ r.TypedSpec().ProductID = fmt.Sprintf("0x%04x", productID)
+
+ r.TypedSpec().Class, _ = pcidb.LookupClass(classID)
+ r.TypedSpec().Subclass, _ = pcidb.LookupSubclass(classID, subclassID)
+ r.TypedSpec().Vendor, _ = pcidb.LookupVendor(vendorID)
+ r.TypedSpec().Product, _ = pcidb.LookupProduct(vendorID, productID)
+
+ return nil
+ }); err != nil {
+ return fmt.Errorf("error modifying output resource: %w", err)
+ }
+ }
+
+ if err = safe.CleanupOutputs[*hardware.PCIDevice](ctx, r); err != nil {
+ return err
+ }
+ }
+}
+
+func readHexPCIInfo(deviceID, info string) (uint64, error) {
+ contents, err := os.ReadFile(filepath.Join("/sys/bus/pci/devices", deviceID, info))
+ if err != nil {
+ return 0, err
+ }
+
+ return strconv.ParseUint(string(bytes.TrimSpace(contents)), 0, 64)
+}
diff --git a/internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_controller.go b/internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_controller.go
index 8be417710f..9f72257376 100644
--- a/internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_controller.go
+++ b/internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_controller.go
@@ -133,6 +133,9 @@ func (ctrl *Controller) Run(ctx context.Context, drainer *runtime.Drainer) error
EtcPath: "/etc",
ShadowPath: constants.SystemEtcPath,
},
+ &hardware.PCIDevicesController{
+ V1Alpha1Mode: ctrl.v1alpha1Runtime.State().Platform().Mode(),
+ },
&hardware.SystemInfoController{
V1Alpha1Mode: ctrl.v1alpha1Runtime.State().Platform().Mode(),
},
diff --git a/internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_state.go b/internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_state.go
index b254358475..a4df8d4793 100644
--- a/internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_state.go
+++ b/internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_state.go
@@ -111,8 +111,9 @@ func NewState() (*State, error) {
&etcd.Member{},
&files.EtcFileSpec{},
&files.EtcFileStatus{},
- &hardware.Processor{},
&hardware.MemoryModule{},
+ &hardware.PCIDevice{},
+ &hardware.Processor{},
&hardware.SystemInformation{},
&k8s.AdmissionControlConfig{},
&k8s.AuditPolicyConfig{},
diff --git a/internal/integration/api/hardware.go b/internal/integration/api/hardware.go
new file mode 100644
index 0000000000..1596f3b01e
--- /dev/null
+++ b/internal/integration/api/hardware.go
@@ -0,0 +1,80 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+//go:build integration_api
+
+package api
+
+import (
+ "context"
+ "time"
+
+ "github.com/cosi-project/runtime/pkg/resource"
+ "github.com/cosi-project/runtime/pkg/safe"
+ "github.com/google/uuid"
+
+ "github.com/siderolabs/talos/internal/integration/base"
+ "github.com/siderolabs/talos/pkg/machinery/client"
+ "github.com/siderolabs/talos/pkg/machinery/resources/hardware"
+)
+
+// HardwareSuite ...
+type HardwareSuite struct {
+ base.APISuite
+
+ ctx context.Context //nolint:containedctx
+ ctxCancel context.CancelFunc
+}
+
+// SuiteName ...
+func (suite *HardwareSuite) SuiteName() string {
+ return "api.HardwareSuite"
+}
+
+// SetupTest ...
+func (suite *HardwareSuite) SetupTest() {
+ if !suite.Capabilities().RunsTalosKernel {
+ suite.T().Skipf("doesn't run Talos kernel, skipping")
+ }
+
+ suite.ctx, suite.ctxCancel = context.WithTimeout(context.Background(), 15*time.Second)
+}
+
+// TearDownTest ...
+func (suite *HardwareSuite) TearDownTest() {
+ if suite.ctxCancel != nil {
+ suite.ctxCancel()
+ }
+}
+
+// TestSystemInformation tests that SystemInformation is populated.
+func (suite *HardwareSuite) TestSystemInformation() {
+ node := suite.RandomDiscoveredNodeInternalIP()
+
+ sysInfo, err := safe.StateGetByID[*hardware.SystemInformation](client.WithNode(suite.ctx, node), suite.Client.COSI, hardware.SystemInformationID)
+ suite.Require().NoError(err)
+
+ suite.Assert().NotEmpty(sysInfo.TypedSpec().UUID)
+ suite.Assert().NotEqual((uuid.UUID{}).String(), sysInfo.TypedSpec().UUID)
+}
+
+// TestHardwareInfo tests that hardware info is populated.
+func (suite *HardwareSuite) TestHardwareInfo() {
+ node := suite.RandomDiscoveredNodeInternalIP()
+
+ for _, resourceType := range []resource.Type{
+ hardware.MemoryModuleType,
+ hardware.ProcessorType,
+ hardware.PCIDeviceType,
+ } {
+ items, err := suite.Client.COSI.List(client.WithNode(suite.ctx, node), resource.NewMetadata(hardware.NamespaceName, resourceType, "", resource.VersionUndefined))
+ suite.Require().NoError(err)
+
+ suite.Assert().NotEmpty(items.Items, "resource type %s is not populated", resourceType)
+ }
+}
+
+func init() {
+ allSuites = append(allSuites, new(HardwareSuite))
+}
diff --git a/pkg/machinery/api/resource/definitions/hardware/hardware.pb.go b/pkg/machinery/api/resource/definitions/hardware/hardware.pb.go
index 980a078ff7..88c60259d8 100644
--- a/pkg/machinery/api/resource/definitions/hardware/hardware.pb.go
+++ b/pkg/machinery/api/resource/definitions/hardware/hardware.pb.go
@@ -125,6 +125,110 @@ func (x *MemoryModuleSpec) GetProductName() string {
return ""
}
+// PCIDeviceSpec represents a single processor.
+type PCIDeviceSpec struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Class string `protobuf:"bytes,1,opt,name=class,proto3" json:"class,omitempty"`
+ Subclass string `protobuf:"bytes,2,opt,name=subclass,proto3" json:"subclass,omitempty"`
+ Vendor string `protobuf:"bytes,3,opt,name=vendor,proto3" json:"vendor,omitempty"`
+ Product string `protobuf:"bytes,4,opt,name=product,proto3" json:"product,omitempty"`
+ ClassId string `protobuf:"bytes,5,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"`
+ SubclassId string `protobuf:"bytes,6,opt,name=subclass_id,json=subclassId,proto3" json:"subclass_id,omitempty"`
+ VendorId string `protobuf:"bytes,7,opt,name=vendor_id,json=vendorId,proto3" json:"vendor_id,omitempty"`
+ ProductId string `protobuf:"bytes,8,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
+}
+
+func (x *PCIDeviceSpec) Reset() {
+ *x = PCIDeviceSpec{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PCIDeviceSpec) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PCIDeviceSpec) ProtoMessage() {}
+
+func (x *PCIDeviceSpec) ProtoReflect() protoreflect.Message {
+ mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PCIDeviceSpec.ProtoReflect.Descriptor instead.
+func (*PCIDeviceSpec) Descriptor() ([]byte, []int) {
+ return file_resource_definitions_hardware_hardware_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *PCIDeviceSpec) GetClass() string {
+ if x != nil {
+ return x.Class
+ }
+ return ""
+}
+
+func (x *PCIDeviceSpec) GetSubclass() string {
+ if x != nil {
+ return x.Subclass
+ }
+ return ""
+}
+
+func (x *PCIDeviceSpec) GetVendor() string {
+ if x != nil {
+ return x.Vendor
+ }
+ return ""
+}
+
+func (x *PCIDeviceSpec) GetProduct() string {
+ if x != nil {
+ return x.Product
+ }
+ return ""
+}
+
+func (x *PCIDeviceSpec) GetClassId() string {
+ if x != nil {
+ return x.ClassId
+ }
+ return ""
+}
+
+func (x *PCIDeviceSpec) GetSubclassId() string {
+ if x != nil {
+ return x.SubclassId
+ }
+ return ""
+}
+
+func (x *PCIDeviceSpec) GetVendorId() string {
+ if x != nil {
+ return x.VendorId
+ }
+ return ""
+}
+
+func (x *PCIDeviceSpec) GetProductId() string {
+ if x != nil {
+ return x.ProductId
+ }
+ return ""
+}
+
// ProcessorSpec represents a single processor.
type ProcessorSpec struct {
state protoimpl.MessageState
@@ -148,7 +252,7 @@ type ProcessorSpec struct {
func (x *ProcessorSpec) Reset() {
*x = ProcessorSpec{}
if protoimpl.UnsafeEnabled {
- mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[1]
+ mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -161,7 +265,7 @@ func (x *ProcessorSpec) String() string {
func (*ProcessorSpec) ProtoMessage() {}
func (x *ProcessorSpec) ProtoReflect() protoreflect.Message {
- mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[1]
+ mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -174,7 +278,7 @@ func (x *ProcessorSpec) ProtoReflect() protoreflect.Message {
// Deprecated: Use ProcessorSpec.ProtoReflect.Descriptor instead.
func (*ProcessorSpec) Descriptor() ([]byte, []int) {
- return file_resource_definitions_hardware_hardware_proto_rawDescGZIP(), []int{1}
+ return file_resource_definitions_hardware_hardware_proto_rawDescGZIP(), []int{2}
}
func (x *ProcessorSpec) GetSocket() string {
@@ -279,7 +383,7 @@ type SystemInformationSpec struct {
func (x *SystemInformationSpec) Reset() {
*x = SystemInformationSpec{}
if protoimpl.UnsafeEnabled {
- mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[2]
+ mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -292,7 +396,7 @@ func (x *SystemInformationSpec) String() string {
func (*SystemInformationSpec) ProtoMessage() {}
func (x *SystemInformationSpec) ProtoReflect() protoreflect.Message {
- mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[2]
+ mi := &file_resource_definitions_hardware_hardware_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -305,7 +409,7 @@ func (x *SystemInformationSpec) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemInformationSpec.ProtoReflect.Descriptor instead.
func (*SystemInformationSpec) Descriptor() ([]byte, []int) {
- return file_resource_definitions_hardware_hardware_proto_rawDescGZIP(), []int{2}
+ return file_resource_definitions_hardware_hardware_proto_rawDescGZIP(), []int{3}
}
func (x *SystemInformationSpec) GetManufacturer() string {
@@ -382,52 +486,67 @@ var file_resource_definitions_hardware_hardware_proto_rawDesc = []byte{
0x61, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x73, 0x73, 0x65, 0x74, 0x54,
0x61, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
- 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x8a, 0x03, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73,
- 0x73, 0x6f, 0x72, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x63, 0x6b, 0x65,
- 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12,
- 0x22, 0x0a, 0x0c, 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65, 0x72, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75,
- 0x72, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e,
- 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75,
- 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x70,
- 0x65, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x70,
- 0x65, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x65,
- 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x74, 0x53, 0x70, 0x65,
- 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01,
- 0x28, 0x0d, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x65,
- 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12,
- 0x1b, 0x0a, 0x09, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x08, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x08, 0x61, 0x73, 0x73, 0x65, 0x74, 0x54, 0x61, 0x67, 0x12, 0x1f, 0x0a, 0x0b,
- 0x70, 0x61, 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a,
- 0x0a, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28,
- 0x0d, 0x52, 0x09, 0x63, 0x6f, 0x72, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c,
- 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01,
- 0x28, 0x0d, 0x52, 0x0b, 0x63, 0x6f, 0x72, 0x65, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12,
- 0x21, 0x0a, 0x0c, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18,
- 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x75,
- 0x6e, 0x74, 0x22, 0xf2, 0x01, 0x0a, 0x15, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66,
- 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x70, 0x65, 0x63, 0x12, 0x22, 0x0a, 0x0c,
- 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65, 0x72,
- 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
- 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e,
- 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a,
- 0x0d, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62,
- 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x77, 0x61, 0x6b, 0x65, 0x5f, 0x75,
- 0x70, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x61,
- 0x6b, 0x65, 0x55, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x6b, 0x75, 0x5f,
- 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6b,
- 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75,
- 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x69, 0x64, 0x65, 0x72, 0x6f, 0x6c, 0x61, 0x62, 0x73,
- 0x2f, 0x74, 0x61, 0x6c, 0x6f, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69,
- 0x6e, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
- 0x65, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x68, 0x61,
- 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xeb, 0x01, 0x0a, 0x0d, 0x50, 0x43, 0x49, 0x44, 0x65, 0x76,
+ 0x69, 0x63, 0x65, 0x53, 0x70, 0x65, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x73, 0x73,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x1a, 0x0a,
+ 0x08, 0x73, 0x75, 0x62, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x08, 0x73, 0x75, 0x62, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, 0x6e,
+ 0x64, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63,
+ 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63,
+ 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x75, 0x62, 0x63, 0x6c, 0x61,
+ 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75, 0x62,
+ 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x76, 0x65, 0x6e, 0x64,
+ 0x6f, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f,
+ 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
+ 0x74, 0x49, 0x64, 0x22, 0x8a, 0x03, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f,
+ 0x72, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x22, 0x0a,
+ 0x0c, 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65, 0x72, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65,
+ 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d,
+ 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+ 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x70, 0x65, 0x65,
+ 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x70, 0x65, 0x65,
+ 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18,
+ 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64,
+ 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d,
+ 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x65, 0x72, 0x69,
+ 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x0a,
+ 0x09, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x08, 0x61, 0x73, 0x73, 0x65, 0x74, 0x54, 0x61, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61,
+ 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0a, 0x70, 0x61, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x63,
+ 0x6f, 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52,
+ 0x09, 0x63, 0x6f, 0x72, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f,
+ 0x72, 0x65, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d,
+ 0x52, 0x0b, 0x63, 0x6f, 0x72, 0x65, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x21, 0x0a,
+ 0x0c, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20,
+ 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74,
+ 0x22, 0xf2, 0x01, 0x0a, 0x15, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x72,
+ 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x70, 0x65, 0x63, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x61,
+ 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0c, 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65, 0x72, 0x12, 0x21,
+ 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d,
+ 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x73,
+ 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
+ 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
+ 0x75, 0x75, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x77, 0x61, 0x6b, 0x65, 0x5f, 0x75, 0x70, 0x5f,
+ 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x61, 0x6b, 0x65,
+ 0x55, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x6b, 0x75, 0x5f, 0x6e, 0x75,
+ 0x6d, 0x62, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6b, 0x75, 0x4e,
+ 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
+ 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x69, 0x64, 0x65, 0x72, 0x6f, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x74,
+ 0x61, 0x6c, 0x6f, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65,
+ 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f,
+ 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x68, 0x61, 0x72, 0x64,
+ 0x77, 0x61, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -442,11 +561,12 @@ func file_resource_definitions_hardware_hardware_proto_rawDescGZIP() []byte {
return file_resource_definitions_hardware_hardware_proto_rawDescData
}
-var file_resource_definitions_hardware_hardware_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
+var file_resource_definitions_hardware_hardware_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_resource_definitions_hardware_hardware_proto_goTypes = []interface{}{
(*MemoryModuleSpec)(nil), // 0: talos.resource.definitions.hardware.MemoryModuleSpec
- (*ProcessorSpec)(nil), // 1: talos.resource.definitions.hardware.ProcessorSpec
- (*SystemInformationSpec)(nil), // 2: talos.resource.definitions.hardware.SystemInformationSpec
+ (*PCIDeviceSpec)(nil), // 1: talos.resource.definitions.hardware.PCIDeviceSpec
+ (*ProcessorSpec)(nil), // 2: talos.resource.definitions.hardware.ProcessorSpec
+ (*SystemInformationSpec)(nil), // 3: talos.resource.definitions.hardware.SystemInformationSpec
}
var file_resource_definitions_hardware_hardware_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@@ -475,7 +595,7 @@ func file_resource_definitions_hardware_hardware_proto_init() {
}
}
file_resource_definitions_hardware_hardware_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ProcessorSpec); i {
+ switch v := v.(*PCIDeviceSpec); i {
case 0:
return &v.state
case 1:
@@ -487,6 +607,18 @@ func file_resource_definitions_hardware_hardware_proto_init() {
}
}
file_resource_definitions_hardware_hardware_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ProcessorSpec); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_resource_definitions_hardware_hardware_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemInformationSpec); i {
case 0:
return &v.state
@@ -505,7 +637,7 @@ func file_resource_definitions_hardware_hardware_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_resource_definitions_hardware_hardware_proto_rawDesc,
NumEnums: 0,
- NumMessages: 3,
+ NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/pkg/machinery/api/resource/definitions/hardware/hardware_vtproto.pb.go b/pkg/machinery/api/resource/definitions/hardware/hardware_vtproto.pb.go
index 8ccfa308af..5c85ede440 100644
--- a/pkg/machinery/api/resource/definitions/hardware/hardware_vtproto.pb.go
+++ b/pkg/machinery/api/resource/definitions/hardware/hardware_vtproto.pb.go
@@ -104,6 +104,95 @@ func (m *MemoryModuleSpec) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *PCIDeviceSpec) MarshalVT() (dAtA []byte, err error) {
+ if m == nil {
+ return nil, nil
+ }
+ size := m.SizeVT()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBufferVT(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *PCIDeviceSpec) MarshalToVT(dAtA []byte) (int, error) {
+ size := m.SizeVT()
+ return m.MarshalToSizedBufferVT(dAtA[:size])
+}
+
+func (m *PCIDeviceSpec) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
+ if m == nil {
+ return 0, nil
+ }
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.unknownFields != nil {
+ i -= len(m.unknownFields)
+ copy(dAtA[i:], m.unknownFields)
+ }
+ if len(m.ProductId) > 0 {
+ i -= len(m.ProductId)
+ copy(dAtA[i:], m.ProductId)
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProductId)))
+ i--
+ dAtA[i] = 0x42
+ }
+ if len(m.VendorId) > 0 {
+ i -= len(m.VendorId)
+ copy(dAtA[i:], m.VendorId)
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.VendorId)))
+ i--
+ dAtA[i] = 0x3a
+ }
+ if len(m.SubclassId) > 0 {
+ i -= len(m.SubclassId)
+ copy(dAtA[i:], m.SubclassId)
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SubclassId)))
+ i--
+ dAtA[i] = 0x32
+ }
+ if len(m.ClassId) > 0 {
+ i -= len(m.ClassId)
+ copy(dAtA[i:], m.ClassId)
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ClassId)))
+ i--
+ dAtA[i] = 0x2a
+ }
+ if len(m.Product) > 0 {
+ i -= len(m.Product)
+ copy(dAtA[i:], m.Product)
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Product)))
+ i--
+ dAtA[i] = 0x22
+ }
+ if len(m.Vendor) > 0 {
+ i -= len(m.Vendor)
+ copy(dAtA[i:], m.Vendor)
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Vendor)))
+ i--
+ dAtA[i] = 0x1a
+ }
+ if len(m.Subclass) > 0 {
+ i -= len(m.Subclass)
+ copy(dAtA[i:], m.Subclass)
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Subclass)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if len(m.Class) > 0 {
+ i -= len(m.Class)
+ copy(dAtA[i:], m.Class)
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Class)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
func (m *ProcessorSpec) MarshalVT() (dAtA []byte, err error) {
if m == nil {
return nil, nil
@@ -331,6 +420,48 @@ func (m *MemoryModuleSpec) SizeVT() (n int) {
return n
}
+func (m *PCIDeviceSpec) SizeVT() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Class)
+ if l > 0 {
+ n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
+ }
+ l = len(m.Subclass)
+ if l > 0 {
+ n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
+ }
+ l = len(m.Vendor)
+ if l > 0 {
+ n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
+ }
+ l = len(m.Product)
+ if l > 0 {
+ n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
+ }
+ l = len(m.ClassId)
+ if l > 0 {
+ n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
+ }
+ l = len(m.SubclassId)
+ if l > 0 {
+ n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
+ }
+ l = len(m.VendorId)
+ if l > 0 {
+ n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
+ }
+ l = len(m.ProductId)
+ if l > 0 {
+ n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
+ }
+ n += len(m.unknownFields)
+ return n
+}
+
func (m *ProcessorSpec) SizeVT() (n int) {
if m == nil {
return 0
@@ -702,6 +833,313 @@ func (m *MemoryModuleSpec) UnmarshalVT(dAtA []byte) error {
}
return nil
}
+func (m *PCIDeviceSpec) UnmarshalVT(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return protohelpers.ErrIntOverflow
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: PCIDeviceSpec: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: PCIDeviceSpec: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Class", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return protohelpers.ErrIntOverflow
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Class = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Subclass", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return protohelpers.ErrIntOverflow
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Subclass = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Vendor", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return protohelpers.ErrIntOverflow
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Vendor = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Product", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return protohelpers.ErrIntOverflow
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Product = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 5:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return protohelpers.ErrIntOverflow
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.ClassId = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 6:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field SubclassId", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return protohelpers.ErrIntOverflow
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.SubclassId = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 7:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field VendorId", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return protohelpers.ErrIntOverflow
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.VendorId = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 8:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ProductId", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return protohelpers.ErrIntOverflow
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.ProductId = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := protohelpers.Skip(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return protohelpers.ErrInvalidLength
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *ProcessorSpec) UnmarshalVT(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
diff --git a/pkg/machinery/resources/hardware/deep_copy.generated.go b/pkg/machinery/resources/hardware/deep_copy.generated.go
index 5bc27170da..c1fd17a274 100644
--- a/pkg/machinery/resources/hardware/deep_copy.generated.go
+++ b/pkg/machinery/resources/hardware/deep_copy.generated.go
@@ -2,7 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-// Code generated by "deep-copy -type MemoryModuleSpec -type ProcessorSpec -type SystemInformationSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
+// Code generated by "deep-copy -type MemoryModuleSpec -type PCIDeviceSpec -type ProcessorSpec -type SystemInformationSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package hardware
@@ -12,6 +12,12 @@ func (o MemoryModuleSpec) DeepCopy() MemoryModuleSpec {
return cp
}
+// DeepCopy generates a deep copy of PCIDeviceSpec.
+func (o PCIDeviceSpec) DeepCopy() PCIDeviceSpec {
+ var cp PCIDeviceSpec = o
+ return cp
+}
+
// DeepCopy generates a deep copy of ProcessorSpec.
func (o ProcessorSpec) DeepCopy() ProcessorSpec {
var cp ProcessorSpec = o
diff --git a/pkg/machinery/resources/hardware/hardware.go b/pkg/machinery/resources/hardware/hardware.go
index dcd783e7c2..b013d6cca3 100644
--- a/pkg/machinery/resources/hardware/hardware.go
+++ b/pkg/machinery/resources/hardware/hardware.go
@@ -8,7 +8,7 @@ import (
"github.com/cosi-project/runtime/pkg/resource"
)
-//go:generate deep-copy -type MemoryModuleSpec -type ProcessorSpec -type SystemInformationSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
+//go:generate deep-copy -type MemoryModuleSpec -type PCIDeviceSpec -type ProcessorSpec -type SystemInformationSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// NamespaceName contains resources related to hardware as a whole.
const NamespaceName resource.Namespace = "hardware"
diff --git a/pkg/machinery/resources/hardware/hardware_test.go b/pkg/machinery/resources/hardware/hardware_test.go
index c87147be21..0cdf11f5a4 100644
--- a/pkg/machinery/resources/hardware/hardware_test.go
+++ b/pkg/machinery/resources/hardware/hardware_test.go
@@ -25,8 +25,10 @@ func TestRegisterResource(t *testing.T) {
resourceRegistry := registry.NewResourceRegistry(resources)
for _, resource := range []meta.ResourceWithRD{
- &hardware.Processor{},
&hardware.MemoryModule{},
+ &hardware.PCIDevice{},
+ &hardware.Processor{},
+ &hardware.SystemInformation{},
} {
assert.NoError(t, resourceRegistry.Register(ctx, resource))
}
diff --git a/pkg/machinery/resources/hardware/pcidevice.go b/pkg/machinery/resources/hardware/pcidevice.go
new file mode 100644
index 0000000000..04896bbd9a
--- /dev/null
+++ b/pkg/machinery/resources/hardware/pcidevice.go
@@ -0,0 +1,85 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+package hardware
+
+import (
+ "github.com/cosi-project/runtime/pkg/resource"
+ "github.com/cosi-project/runtime/pkg/resource/meta"
+ "github.com/cosi-project/runtime/pkg/resource/protobuf"
+ "github.com/cosi-project/runtime/pkg/resource/typed"
+
+ "github.com/siderolabs/talos/pkg/machinery/proto"
+)
+
+// PCIDeviceType is type of PCIDevice resource.
+const PCIDeviceType = resource.Type("PCIDevices.hardware.talos.dev")
+
+// PCIDevice resource holds node PCIDevice information.
+type PCIDevice = typed.Resource[PCIDeviceSpec, PCIDeviceExtension]
+
+// PCIDeviceSpec represents a single processor.
+//
+//gotagsrewrite:gen
+type PCIDeviceSpec struct {
+ Class string `yaml:"class,omitempty" protobuf:"1"`
+ Subclass string `yaml:"subclass,omitempty" protobuf:"2"`
+ Vendor string `yaml:"vendor,omitempty" protobuf:"3"`
+ Product string `yaml:"product,omitempty" protobuf:"4"`
+
+ ClassID string `yaml:"class_id" protobuf:"5"`
+ SubclassID string `yaml:"subclass_id" protobuf:"6"`
+ VendorID string `yaml:"vendor_id" protobuf:"7"`
+ ProductID string `yaml:"product_id" protobuf:"8"`
+}
+
+// NewPCIDeviceInfo initializes a PCIDeviceInfo resource.
+func NewPCIDeviceInfo(id string) *PCIDevice {
+ return typed.NewResource[PCIDeviceSpec, PCIDeviceExtension](
+ resource.NewMetadata(NamespaceName, PCIDeviceType, id, resource.VersionUndefined),
+ PCIDeviceSpec{},
+ )
+}
+
+// PCIDeviceExtension provides auxiliary methods for PCIDevice info.
+type PCIDeviceExtension struct{}
+
+// ResourceDefinition implements [typed.Extension] interface.
+func (PCIDeviceExtension) ResourceDefinition() meta.ResourceDefinitionSpec {
+ return meta.ResourceDefinitionSpec{
+ Type: PCIDeviceType,
+ Aliases: []resource.Type{
+ "cpus",
+ "cpu",
+ },
+ DefaultNamespace: NamespaceName,
+ PrintColumns: []meta.PrintColumn{
+ {
+ Name: "Class",
+ JSONPath: `{.class}`,
+ },
+ {
+ Name: "Subclass",
+ JSONPath: `{.subclass}`,
+ },
+ {
+ Name: "Vendor",
+ JSONPath: `{.vendor}`,
+ },
+ {
+ Name: "Product",
+ JSONPath: `{.product}`,
+ },
+ },
+ }
+}
+
+func init() {
+ proto.RegisterDefaultTypes()
+
+ err := protobuf.RegisterDynamic[PCIDeviceSpec](PCIDeviceType, &PCIDevice{})
+ if err != nil {
+ panic(err)
+ }
+}
diff --git a/website/content/v1.8/reference/api.md b/website/content/v1.8/reference/api.md
index ba9f7af8b4..d2e6e7faa2 100644
--- a/website/content/v1.8/reference/api.md
+++ b/website/content/v1.8/reference/api.md
@@ -95,6 +95,7 @@ description: Talos gRPC API reference.
- [resource/definitions/hardware/hardware.proto](#resource/definitions/hardware/hardware.proto)
- [MemoryModuleSpec](#talos.resource.definitions.hardware.MemoryModuleSpec)
+ - [PCIDeviceSpec](#talos.resource.definitions.hardware.PCIDeviceSpec)
- [ProcessorSpec](#talos.resource.definitions.hardware.ProcessorSpec)
- [SystemInformationSpec](#talos.resource.definitions.hardware.SystemInformationSpec)
@@ -1854,6 +1855,28 @@ MemoryModuleSpec represents a single Memory.
+
+
+### PCIDeviceSpec
+PCIDeviceSpec represents a single processor.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| class | [string](#string) | | |
+| subclass | [string](#string) | | |
+| vendor | [string](#string) | | |
+| product | [string](#string) | | |
+| class_id | [string](#string) | | |
+| subclass_id | [string](#string) | | |
+| vendor_id | [string](#string) | | |
+| product_id | [string](#string) | | |
+
+
+
+
+
+
### ProcessorSpec