File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
2121 "os"
2222 "path"
2323 "path/filepath"
24+ "regexp"
2425 "slices"
2526 "strings"
2627 "time"
@@ -42,6 +43,10 @@ const (
4243 operationFinishSteps = 15
4344)
4445
46+ var (
47+ pciAddressRegex = regexp .MustCompile (`^[0-9a-fA-F]{4}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}\.[0-9a-fA-F]$` )
48+ )
49+
4550type IMount interface {
4651 Mounter () * mount.SafeFormatAndMount
4752 ScanForAttach (devicePath string ) error
@@ -159,8 +164,9 @@ func GetEmptyPCIeRootPorts() (int64, error) {
159164 klog .Errorf ("failed to read dir %s : %v" , devPath , err2 )
160165 }
161166 for _ , file := range files {
162- // PCI addresses always contain a colon
163- if strings .Contains (file .Name (), ":" ) {
167+ // Ignore PCI bus directories such as pci001 pci002 and pci010
168+ // Devices must follow <domain:bus:device.function> format
169+ if pciAddressRegex .MatchString (file .Name ()) {
164170 hasChild = true
165171 break
166172 }
You can’t perform that action at this time.
0 commit comments