Skip to content

Commit 7d3cf4d

Browse files
author
zhouhao
committed
validate: modify the validation of mounts.type
Signed-off-by: zhouhao <[email protected]>
1 parent 7150e8d commit 7d3cf4d

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

validate/validate.go

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,31 @@ func (v *Validator) CheckRlimits() (msgs []string) {
337337
func supportedMountTypes(OS string, hostSpecific bool) (map[string]bool, error) {
338338
supportedTypes := make(map[string]bool)
339339

340-
if OS != "linux" && OS != "windows" {
340+
if OS != "linux" && OS != "solaris" {
341341
logrus.Warnf("%v is not supported to check mount type", OS)
342342
return nil, nil
343-
} else if OS == "windows" {
344-
supportedTypes["ntfs"] = true
343+
} else if OS == "solaris" {
344+
f, err := os.Open("/etc/vfstab")
345+
if err != nil {
346+
return nil, err
347+
}
348+
defer f.Close()
349+
350+
s := bufio.NewScanner(f)
351+
for s.Scan() {
352+
if err := s.Err(); err != nil {
353+
return supportedTypes, err
354+
}
355+
356+
text := s.Text()
357+
parts := strings.Split(text, "\t")
358+
if len(parts) > 1 {
359+
supportedTypes[parts[1]] = true
360+
} else {
361+
supportedTypes[parts[0]] = true
362+
}
363+
}
364+
345365
return supportedTypes, nil
346366
}
347367

0 commit comments

Comments
 (0)