Debugging isObjectiveFsMount
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-03 16:23:48 +02:00
parent 6fe3479cf4
commit 77262a5231

15
main.go
View File

@@ -402,7 +402,7 @@ func (d *ofsDriver) Mount(r *volume.MountRequest) (*volume.MountResponse, error)
// success.
for {
// Check for process exit
time.Sleep(100 * time.Millisecond)
time.Sleep(10000 * time.Millisecond)
if cmd.ProcessState != nil {
// The process has exited so consider an error occured
log.WithFields(log.Fields{"name": r.Name, "exitStatus": cmd.ProcessState.ExitCode()}).Error("Volume mount failed")
@@ -823,8 +823,19 @@ func isObjectiveFsMount(path string) (bool, error) {
scanner := bufio.NewScanner(strings.NewReader(string(data)))
// On success the first line contains column headers (in our case "Mounted on")
// and the second line contains the nearest mount point on the root path
return scanner.Scan() && scanner.Scan() && strings.TrimSpace(scanner.Text()) == path, nil
//return scanner.Scan() && scanner.Scan() && strings.TrimSpace(scanner.Text()) == path, nil
isOk := scanner.Scan()
isOk = isOk && scanner.Scan()
if isOk {
line := strings.TrimSpace(scanner.Text())
log.WithFields(log.Fields{"mountInfo": line, "path": path, "matches": line == path}).Info("isObjectiveFsMount")
return line == path, nil
} else {
log.WithFields(log.Fields{"path": path, "matches": false}).Info("isObjectiveFsMount")
return false, nil
}
} else {
log.WithFields(log.Fields{"path": path}).Info("isObjectiveFsMount")
return false, err
}
}