Skip to content

Commit 482cd1d

Browse files
committed
debug print
Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
1 parent 50a8950 commit 482cd1d

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

pkg/csi/blockstorage/nodeserver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ func (ns *nodeServer) NodeGetInfo(ctx context.Context, _ *csi.NodeGetInfoRequest
314314
if err != nil {
315315
klog.Errorf("[NodeGetInfo] unable to retrieve PCIe root ports %v", err)
316316
} else {
317-
if emptyPCIeRootPorts <= 0 {
317+
klog.Infof("[NodeGetInfo] found empty PCIe root ports: %d", emptyPCIeRootPorts)
318+
if emptyPCIeRootPorts == 0 {
318319
klog.Warningf("[NodeGetInfo] node does not have any free PCIe ports")
319320
maxVolumesPerNode = 0
320321
} else {

pkg/csi/util/mount/mount.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func GetEmptyPCIeRootPorts() (int64, error) {
142142
// We check the 'class' file. PCI Bridge class code starts with 0x0604
143143
classBuf, err := os.ReadFile(filepath.Join(devPath, "class"))
144144
if err != nil {
145+
klog.Errorf("failed to read PCI device class %s : %v", devPath, err)
145146
continue
146147
}
147148
class := strings.TrimSpace(string(classBuf))
@@ -153,7 +154,10 @@ func GetEmptyPCIeRootPorts() (int64, error) {
153154
// If the bridge has children, they appear as subdirectories
154155
// matching the PCI address format (e.g., 0000:01:00.0)
155156
hasChild := false
156-
files, _ := os.ReadDir(devPath)
157+
files, err2 := os.ReadDir(devPath)
158+
if err2 != nil {
159+
klog.Errorf("failed to read dir %s : %v", devPath, err2)
160+
}
157161
for _, file := range files {
158162
// PCI addresses always contain a colon
159163
if strings.Contains(file.Name(), ":") {
@@ -165,6 +169,8 @@ func GetEmptyPCIeRootPorts() (int64, error) {
165169
if !hasChild {
166170
emptyCount++
167171
}
172+
} else {
173+
klog.Infof("skipping class %s: path: %s", class, devPath)
168174
}
169175
}
170176

0 commit comments

Comments
 (0)