Refactor volume interfaces to receive pod instead of ObjectReference

This commit is contained in:
Paul Morie
2015-05-10 20:12:57 -04:00
parent 738f403eea
commit cd359ffa73
21 changed files with 93 additions and 88 deletions

View File

@@ -64,18 +64,18 @@ func (plugin *nfsPlugin) GetAccessModes() []api.AccessModeType {
}
}
func (plugin *nfsPlugin) NewBuilder(spec *volume.Spec, podRef *api.ObjectReference, _ volume.VolumeOptions, _ mount.Interface) (volume.Builder, error) {
return plugin.newBuilderInternal(spec, podRef, plugin.mounter)
func (plugin *nfsPlugin) NewBuilder(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions, _ mount.Interface) (volume.Builder, error) {
return plugin.newBuilderInternal(spec, pod, plugin.mounter)
}
func (plugin *nfsPlugin) newBuilderInternal(spec *volume.Spec, podRef *api.ObjectReference, mounter mount.Interface) (volume.Builder, error) {
func (plugin *nfsPlugin) newBuilderInternal(spec *volume.Spec, pod *api.Pod, mounter mount.Interface) (volume.Builder, error) {
return &nfs{
volName: spec.Name,
server: spec.VolumeSource.NFS.Server,
exportPath: spec.VolumeSource.NFS.Path,
readOnly: spec.VolumeSource.NFS.ReadOnly,
mounter: mounter,
podRef: podRef,
pod: pod,
plugin: plugin,
}, nil
}
@@ -91,7 +91,7 @@ func (plugin *nfsPlugin) newCleanerInternal(volName string, podUID types.UID, mo
exportPath: "",
readOnly: false,
mounter: mounter,
podRef: &api.ObjectReference{UID: podUID},
pod: &api.Pod{ObjectMeta: api.ObjectMeta{UID: podUID}},
plugin: plugin,
}, nil
}
@@ -99,7 +99,7 @@ func (plugin *nfsPlugin) newCleanerInternal(volName string, podUID types.UID, mo
// NFS volumes represent a bare host file or directory mount of an NFS export.
type nfs struct {
volName string
podRef *api.ObjectReference
pod *api.Pod
server string
exportPath string
readOnly bool
@@ -158,7 +158,7 @@ func (nfsVolume *nfs) SetUpAt(dir string) error {
func (nfsVolume *nfs) GetPath() string {
name := nfsPluginName
return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.podRef.UID, util.EscapeQualifiedNameForDisk(name), nfsVolume.volName)
return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, util.EscapeQualifiedNameForDisk(name), nfsVolume.volName)
}
func (nfsVolume *nfs) TearDown() error {