Rename volume.Builder to Mounter and volume.Cleaner to Unmounter

This commit is contained in:
saadali
2016-03-22 22:12:21 -07:00
parent 590038dcf1
commit 79012f6d53
63 changed files with 877 additions and 877 deletions

View File

@@ -69,7 +69,7 @@ func (fake *fakeDiskManager) Cleanup() {
func (fake *fakeDiskManager) MakeGlobalPDName(disk rbd) string {
return fake.tmpDir
}
func (fake *fakeDiskManager) AttachDisk(b rbdBuilder) error {
func (fake *fakeDiskManager) AttachDisk(b rbdMounter) error {
globalPath := b.manager.MakeGlobalPDName(*b.rbd)
err := os.MkdirAll(globalPath, 0750)
if err != nil {
@@ -78,7 +78,7 @@ func (fake *fakeDiskManager) AttachDisk(b rbdBuilder) error {
return nil
}
func (fake *fakeDiskManager) DetachDisk(c rbdCleaner, mntPath string) error {
func (fake *fakeDiskManager) DetachDisk(c rbdUnmounter, mntPath string) error {
globalPath := c.manager.MakeGlobalPDName(*c.rbd)
err := os.RemoveAll(globalPath)
if err != nil {
@@ -103,21 +103,21 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
}
fdm := NewFakeDiskManager()
defer fdm.Cleanup()
builder, err := plug.(*rbdPlugin).newBuilderInternal(spec, types.UID("poduid"), fdm, &mount.FakeMounter{}, "secrets")
mounter, err := plug.(*rbdPlugin).newMounterInternal(spec, types.UID("poduid"), fdm, &mount.FakeMounter{}, "secrets")
if err != nil {
t.Errorf("Failed to make a new Builder: %v", err)
t.Errorf("Failed to make a new Mounter: %v", err)
}
if builder == nil {
t.Error("Got a nil Builder")
if mounter == nil {
t.Error("Got a nil Mounter")
}
path := builder.GetPath()
path := mounter.GetPath()
expectedPath := fmt.Sprintf("%s/pods/poduid/volumes/kubernetes.io~rbd/vol1", tmpDir)
if path != expectedPath {
t.Errorf("Unexpected path, expected %q, got: %q", expectedPath, path)
}
if err := builder.SetUp(nil); err != nil {
if err := mounter.SetUp(nil); err != nil {
t.Errorf("Expected success, got: %v", err)
}
if _, err := os.Stat(path); err != nil {
@@ -135,15 +135,15 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
}
}
cleaner, err := plug.(*rbdPlugin).newCleanerInternal("vol1", types.UID("poduid"), fdm, &mount.FakeMounter{})
unmounter, err := plug.(*rbdPlugin).newUnmounterInternal("vol1", types.UID("poduid"), fdm, &mount.FakeMounter{})
if err != nil {
t.Errorf("Failed to make a new Cleaner: %v", err)
t.Errorf("Failed to make a new Unmounter: %v", err)
}
if cleaner == nil {
t.Error("Got a nil Cleaner")
if unmounter == nil {
t.Error("Got a nil Unmounter")
}
if err := cleaner.TearDown(); err != nil {
if err := unmounter.TearDown(); err != nil {
t.Errorf("Expected success, got: %v", err)
}
if _, err := os.Stat(path); err == nil {
@@ -229,12 +229,12 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil))
plug, _ := plugMgr.FindPluginByName(rbdPluginName)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}}
builder, _ := plug.NewBuilder(spec, pod, volume.VolumeOptions{})
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !builder.GetAttributes().ReadOnly {
t.Errorf("Expected true for builder.IsReadOnly")
if !mounter.GetAttributes().ReadOnly {
t.Errorf("Expected true for mounter.IsReadOnly")
}
}