Skip to content

Commit 9e97695

Browse files
author
zhouhao
committed
validate: modify the validation of mounts.type
Signed-off-by: zhouhao <[email protected]>
1 parent 6bcd3b4 commit 9e97695

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

validate/validate.go

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,28 @@ func (v *Validator) CheckRlimits() (msgs []string) {
353353
func supportedMountTypes(OS string, hostSpecific bool) (map[string]bool, error) {
354354
supportedTypes := make(map[string]bool)
355355

356-
if OS != "linux" && OS != "windows" {
357-
logrus.Warnf("%v is not supported to check mount type", OS)
358-
return nil, nil
359-
} else if OS == "windows" {
360-
supportedTypes["ntfs"] = true
356+
if OS == "solaris" {
357+
f, err := os.Open("/etc/vfstab")
358+
if err != nil {
359+
return nil, err
360+
}
361+
defer f.Close()
362+
363+
s := bufio.NewScanner(f)
364+
for s.Scan() {
365+
if err := s.Err(); err != nil {
366+
return supportedTypes, err
367+
}
368+
369+
text := s.Text()
370+
parts := strings.Split(text, "\t")
371+
if len(parts) > 1 {
372+
supportedTypes[parts[1]] = true
373+
} else {
374+
supportedTypes[parts[0]] = true
375+
}
376+
}
377+
361378
return supportedTypes, nil
362379
}
363380

0 commit comments

Comments
 (0)