Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PCI device information #62

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add PCI device information
Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
glimchb committed Feb 17, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit e2fe1442bf133dc3f406d2cf4a50c5a9478602a3
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
9 changes: 9 additions & 0 deletions pkg/inventory/inventory.go
Original file line number Diff line number Diff line change
@@ -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
}