Small clean-ups

This commit is contained in:
Justin Santa Barbara
2015-04-02 11:56:11 -07:00
parent f2184e0860
commit 6c823dbdab
3 changed files with 24 additions and 17 deletions

View File

@@ -231,7 +231,10 @@ func (pd *awsPersistentDisk) SetUpAt(dir string) error {
}
func makeGlobalPDName(host volume.VolumeHost, devName string) string {
return path.Join(host.GetPluginDir(awsPersistentDiskPluginName), "mounts", devName)
// Clean up the URI to be more fs-friendly
name := devName
name = strings.Replace(name, "://", "/", -1)
return path.Join(host.GetPluginDir(awsPersistentDiskPluginName), "mounts", name)
}
func (pd *awsPersistentDisk) GetPath() string {

View File

@@ -20,7 +20,6 @@ import (
"errors"
"fmt"
"os"
"path"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/exec"
@@ -41,12 +40,12 @@ func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath
if pd.readOnly {
flags = mount.FlagReadOnly
}
if err := volumes.AttachDisk("", pd.pdName, pd.readOnly); err != nil {
devicePath, err := volumes.AttachDisk("", pd.pdName, pd.readOnly)
if err != nil {
return err
}
devicePath := path.Join("/dev/disk/by-id/", "aws-"+pd.pdName)
if pd.partition != "" {
devicePath = devicePath + "-part" + pd.partition
devicePath = devicePath + pd.partition
}
//TODO(jonesdl) There should probably be better method than busy-waiting here.
numTries := 0
@@ -60,7 +59,7 @@ func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath
}
numTries++
if numTries == 10 {
return errors.New("Could not attach disk: Timeout after 10s")
return errors.New("Could not attach disk: Timeout after 10s (" + devicePath + ")")
}
time.Sleep(time.Second)
}