Skip to content

Commit

Permalink
Add PCI device information
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <[email protected]>
  • Loading branch information
glimchb committed Feb 17, 2023
1 parent 8d413e9 commit e2fe144
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN go build -v -buildmode=plugin -o /opi-smbios-bridge.so /app/pkg/... \

# second stage to reduce image size
FROM alpine:3.17
RUN apk add --no-cache libc6-compat
RUN apk add --no-cache libc6-compat hwdata
COPY --from=builder /opi-smbios-bridge /
COPY --from=builder /opi-smbios-bridge.so /
COPY --from=docker.io/fullstorydev/grpcurl:v1.8.7-alpine /bin/grpcurl /usr/local/bin/
Expand Down
9 changes: 9 additions & 0 deletions pkg/inventory/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,21 @@ func (s *server) InventoryGet(ctx context.Context, in *pc.InventoryGetRequest) (
}
fmt.Printf("%v\n", product)

pci, err := ghw.PCI()
if err != nil {
fmt.Printf("Error getting pci info: %v", err)
}
for _, dev := range pci.Devices {
fmt.Printf("PCI=%v\n", dev.String())
}

return &pc.InventoryGetResponse{
Bios: &pc.BIOSInfo{Vendor: bios.Vendor, Version: bios.Version, Date: bios.Date},
System: &pc.SystemInfo{Family: product.Family, Name: product.Name, Vendor: product.Vendor, SerialNumber: product.SerialNumber, Uuid: product.UUID, Sku: product.SKU, Version: product.Version},
Baseboard: &pc.BaseboardInfo{AssetTag: baseboard.AssetTag, SerialNumber: baseboard.SerialNumber, Vendor: baseboard.Vendor, Version: baseboard.Version, Product: baseboard.Product},
Chassis: &pc.ChassisInfo{AssetTag: chassis.AssetTag, SerialNumber: chassis.SerialNumber, Type: chassis.Type, TypeDescription: chassis.TypeDescription, Vendor: chassis.Vendor, Version: chassis.Version},
Processor: &pc.CPUInfo{TotalCores: int32(cpu.TotalCores), TotalThreads: int32(cpu.TotalThreads)},
Memory: &pc.MemoryInfo{TotalPhysicalBytes: memory.TotalPhysicalBytes, TotalUsableBytes: memory.TotalUsableBytes},
// Pci: &PCIeDeviceInfo{},
}, nil
}

0 comments on commit e2fe144

Please sign in to comment.