Mount r/w GCE PD disks with -o discard

As per
https://cloud.google.com/compute/docs/disks/add-persistent-disk#formatting.
This commit is contained in:
Tim Hockin 2016-07-03 21:30:18 -07:00
parent d07328dc4a
commit 8efefab9a3

View File

@ -165,6 +165,9 @@ func (attacher *gcePersistentDiskAttacher) MountDevice(spec *volume.Spec, device
options := []string{}
if readOnly {
options = append(options, "ro")
} else {
// as per https://cloud.google.com/compute/docs/disks/add-persistent-disk#formatting
options = append(options, "discard")
}
if notMnt {
diskMounter := &mount.SafeFormatAndMount{Interface: mounter, Runner: exec.New()}