Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make gce_safe_format_and_mount actually work correctly. #4221

Merged
merged 2 commits into from
Feb 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 25 additions & 20 deletions pkg/kubelet/volume/gce_pd/gce_pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/exec"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/mount"
"github.com/golang/glog"
)
Expand Down Expand Up @@ -89,16 +90,17 @@ func (plugin *gcePersistentDiskPlugin) newBuilderInternal(spec *api.Volume, podU
readOnly := spec.Source.GCEPersistentDisk.ReadOnly

return &gcePersistentDisk{
podUID: podUID,
volName: spec.Name,
pdName: pdName,
fsType: fsType,
partition: partition,
readOnly: readOnly,
manager: manager,
mounter: mounter,
plugin: plugin,
legacyMode: false,
podUID: podUID,
volName: spec.Name,
pdName: pdName,
fsType: fsType,
partition: partition,
readOnly: readOnly,
manager: manager,
mounter: mounter,
diskMounter: &gceSafeFormatAndMount{mounter, exec.New()},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where this is ever used?

plugin: plugin,
legacyMode: false,
}, nil
}

Expand All @@ -113,12 +115,13 @@ func (plugin *gcePersistentDiskPlugin) newCleanerInternal(volName string, podUID
legacy = true
}
return &gcePersistentDisk{
podUID: podUID,
volName: volName,
manager: manager,
mounter: mounter,
plugin: plugin,
legacyMode: legacy,
podUID: podUID,
volName: volName,
manager: manager,
mounter: mounter,
diskMounter: &gceSafeFormatAndMount{mounter, exec.New()},
plugin: plugin,
legacyMode: legacy,
}, nil
}

Expand All @@ -145,10 +148,12 @@ type gcePersistentDisk struct {
readOnly bool
// Utility interface that provides API calls to the provider to attach/detach disks.
manager pdManager
// Mounter interface that provides system calls to mount the disks.
mounter mount.Interface
plugin *gcePersistentDiskPlugin
legacyMode bool
// Mounter interface that provides system calls to mount the global path to the pod local path.
mounter mount.Interface
// diskMounter provides the interface that is used to mount the actual block device.
diskMounter mount.Interface
plugin *gcePersistentDiskPlugin
legacyMode bool
}

func detachDiskLogError(pd *gcePersistentDisk) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/volume/gce_pd/gce_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (util *GCEDiskUtil) DetachDisk(pd *gcePersistentDisk, devicePath string) er
// This eliminates the necesisty to format a PD before it is used with a Pod on GCE.
// TODO: port this script into Go and use it for all Linux platforms
type gceSafeFormatAndMount struct {
mount.Mounter
mount.Interface
runner exec.Interface
}

Expand Down