Skip to content

Commit

Permalink
support dbfs version config
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkan committed Feb 25, 2021
1 parent baa3f66 commit 77d50f5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/dbfs/nodeserver.go
Expand Up @@ -159,7 +159,14 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
}

// Get dbfs config path
cmd := fmt.Sprintf("%s /opt/dbfs/app/1.0.0.1/bin/dbfs_get_home_path.sh %s", NsenterCmd, dbfsID)
dbfsVersion := os.Getenv("DBFS_CONFIG_VERSION")
if dbfsVersion == "" {
dbfsVersion := getDbfsVersion(dbfsID)
if dbfsVersion == "" {
dbfsVersion = "1.0.0.2"
}
}
cmd := fmt.Sprintf("%s /opt/dbfs/app/%s/bin/dbfs_get_home_path.sh %s", NsenterCmd, dbfsVersion, dbfsID)
out, err := utils.Run(cmd)
if err != nil {
log.Errorf("NodePublishVolume: get dbfs config volume path %s with error: %s", req.VolumeId, err.Error())
Expand Down
11 changes: 11 additions & 0 deletions pkg/dbfs/utils.go
Expand Up @@ -224,3 +224,14 @@ func GetPvNameFormMntPoint(mntPath string) string {
}
return ""
}

// getDbfsVersion get dbfs config version from config file
func getDbfsVersion(dbfsID string) string {
cmd := fmt.Sprintf("%s cat /opt/dbfs/config/version.conf", NsenterCmd)
out, err := utils.Run(cmd)
if err != nil {
log.Errorf("getDbfsVersion: %s with error: %s", dbfsID, err.Error())
return ""
}
return strings.TrimSpace(out)
}

0 comments on commit 77d50f5

Please sign in to comment.