add disk type (prefix) to instance volume model
This commit is contained in:
15
app/utils.go
15
app/utils.go
@@ -36,7 +36,7 @@ func GetConfig(configPath string) Config {
|
||||
return config
|
||||
}
|
||||
|
||||
// returns if a device pcie bus id is a super device or subsystem device
|
||||
// checks if a device pcie bus id is a super device or subsystem device
|
||||
//
|
||||
// subsystem devices always has the format xxxx:yy.z, whereas super devices have the format xxxx:yy
|
||||
//
|
||||
@@ -44,3 +44,16 @@ func GetConfig(configPath string) Config {
|
||||
func DeviceBusIDIsSuperDevice(BusID DeviceID) bool {
|
||||
return !strings.ContainsRune(string(BusID), '.')
|
||||
}
|
||||
|
||||
// checks if string s has one of any prefixes, and returns the prefix or "" if there was no match
|
||||
//
|
||||
// matches the first prefix match in array order
|
||||
func AnyPrefixes(s string, prefixes []string) string {
|
||||
for _, prefix := range prefixes {
|
||||
if strings.HasPrefix(s, prefix) {
|
||||
return prefix
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user