Fix pd name parse
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -248,11 +249,12 @@ func getPdNameFromGlobalMount(host volume.VolumeHost, globalPath string) (string
|
|||||||
return "", fmt.Errorf("Unexpected mount path: " + globalPath)
|
return "", fmt.Errorf("Unexpected mount path: " + globalPath)
|
||||||
}
|
}
|
||||||
// Reverse the :// replacement done in makeGlobalPDName
|
// Reverse the :// replacement done in makeGlobalPDName
|
||||||
name := rel
|
pdName := rel
|
||||||
if strings.HasPrefix(name, "aws/") {
|
if strings.HasPrefix(pdName, "aws/") {
|
||||||
name = strings.Replace(name, "aws/", "aws://")
|
pdName = strings.Replace(pdName, "aws/", "aws://", 1)
|
||||||
}
|
}
|
||||||
return name, nil
|
glog.V(2).Info("Mapping mount dir ", globalPath, " to pdName ", pdName)
|
||||||
|
return pdName, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pd *awsPersistentDisk) GetPath() string {
|
func (pd *awsPersistentDisk) GetPath() string {
|
||||||
@@ -293,7 +295,7 @@ func (pd *awsPersistentDisk) TearDownAt(dir string) error {
|
|||||||
// remaining reference is the global mount. It is safe to detach.
|
// remaining reference is the global mount. It is safe to detach.
|
||||||
if len(refs) == 1 {
|
if len(refs) == 1 {
|
||||||
// pd.pdName is not initially set for volume-cleaners, so set it here.
|
// pd.pdName is not initially set for volume-cleaners, so set it here.
|
||||||
pd.pdName, err = getPdNameFromGlobalMount(refs[0])
|
pd.pdName, err = getPdNameFromGlobalMount(pd.plugin.host, refs[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(2).Info("Could not determine pdName from mountpoint ", refs[0], ": ", err)
|
glog.V(2).Info("Could not determine pdName from mountpoint ", refs[0], ": ", err)
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user