17296: Merge branch 'master'
[arvados.git] / lib / crunchrun / copier.go
index 132101028ea4d6d5b6b8a76df5238d7ceb0effb7..72c714dfa4ef47bbe4d60adff4693edd97e7b7cb 100644 (file)
@@ -55,7 +55,7 @@ type copier struct {
        keepClient    IKeepClient
        hostOutputDir string
        ctrOutputDir  string
-       binds         []string
+       bindmounts    map[string]bindmount
        mounts        map[string]arvados.Mount
        secretMounts  map[string]arvados.Mount
        logger        printfer
@@ -341,11 +341,8 @@ func (cp *copier) hostRoot(ctrRoot string) (string, error) {
        if ctrRoot == cp.ctrOutputDir {
                return cp.hostOutputDir, nil
        }
-       for _, bind := range cp.binds {
-               tokens := strings.Split(bind, ":")
-               if len(tokens) >= 2 && tokens[1] == ctrRoot {
-                       return tokens[0], nil
-               }
+       if mnt, ok := cp.bindmounts[ctrRoot]; ok {
+               return mnt.HostPath, nil
        }
        return "", fmt.Errorf("not bind-mounted: %q", ctrRoot)
 }