rename StorageType StorageMedium

This commit is contained in:
Tim Hockin 2015-05-18 13:26:09 -07:00
parent f66ca25d9f
commit fd22f48f5b
11 changed files with 41 additions and 41 deletions

View File

@ -354,15 +354,15 @@ type EmptyDirVolumeSource struct {
// this will cover the most common needs.
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium"`
Medium StorageMedium `json:"medium"`
}
// StorageType defines ways that storage can be allocated to a volume.
type StorageType string
// StorageMedium defines ways that storage can be allocated to a volume.
type StorageMedium string
const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs)
StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
)
// Protocol defines network protocols supported for things like conatiner ports.

View File

@ -657,7 +657,7 @@ func convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVol
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*EmptyDirVolumeSource))(in)
}
out.Medium = newer.StorageType(in.Medium)
out.Medium = newer.StorageMedium(in.Medium)
return nil
}
@ -665,7 +665,7 @@ func convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *newer.Empty
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*newer.EmptyDirVolumeSource))(in)
}
out.Medium = StorageType(in.Medium)
out.Medium = StorageMedium(in.Medium)
return nil
}

View File

@ -366,7 +366,7 @@ type HostPathVolumeSource struct {
type EmptyDirVolumeSource struct {
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
Medium StorageMedium `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
}
// GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod
@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"`
}
// StorageType defines ways that storage can be allocated to a volume.
type StorageType string
// StorageMedium defines ways that storage can be allocated to a volume.
type StorageMedium string
const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs)
StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
)
// Protocol defines network protocols supported for things like conatiner ports.

View File

@ -267,15 +267,15 @@ type HostPathVolumeSource struct {
type EmptyDirVolumeSource struct {
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
Medium StorageMedium `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
}
// StorageType defines ways that storage can be allocated to a volume.
type StorageType string
// StorageMedium defines ways that storage can be allocated to a volume.
type StorageMedium string
const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs)
StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
)
// Protocol defines network protocols supported for things like conatiner ports.

View File

@ -235,15 +235,15 @@ type HostPathVolumeSource struct {
type EmptyDirVolumeSource struct {
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
Medium StorageMedium `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
}
// StorageType defines ways that storage can be allocated to a volume.
type StorageType string
// StorageMedium defines ways that storage can be allocated to a volume.
type StorageMedium string
const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs)
StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
)
// SecretVolumeSource adapts a Secret into a VolumeSource

View File

@ -471,7 +471,7 @@ func convert_v1beta3_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyD
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*EmptyDirVolumeSource))(in)
}
out.Medium = newer.StorageType(in.Medium)
out.Medium = newer.StorageMedium(in.Medium)
return nil
}
@ -479,7 +479,7 @@ func convert_api_EmptyDirVolumeSource_To_v1beta3_EmptyDirVolumeSource(in *newer.
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*newer.EmptyDirVolumeSource))(in)
}
out.Medium = StorageType(in.Medium)
out.Medium = StorageMedium(in.Medium)
return nil
}

View File

@ -366,7 +366,7 @@ type HostPathVolumeSource struct {
type EmptyDirVolumeSource struct {
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
Medium StorageMedium `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
}
// GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod
@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"`
}
// StorageType defines ways that storage can be allocated to a volume.
type StorageType string
// StorageMedium defines ways that storage can be allocated to a volume.
type StorageMedium string
const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs)
StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
)
// Protocol defines network protocols supported for things like conatiner ports.

View File

@ -80,7 +80,7 @@ func (plugin *emptyDirPlugin) newBuilderInternal(spec *volume.Spec, pod *api.Pod
// Legacy mode instances can be cleaned up but not created anew.
return nil, fmt.Errorf("legacy mode: can not create new instances")
}
medium := api.StorageTypeDefault
medium := api.StorageMediumDefault
if spec.VolumeSource.EmptyDir != nil { // Support a non-specified source as EmptyDir.
medium = spec.VolumeSource.EmptyDir.Medium
}
@ -109,7 +109,7 @@ func (plugin *emptyDirPlugin) newCleanerInternal(volName string, podUID types.UI
ed := &emptyDir{
podUID: podUID,
volName: volName,
medium: api.StorageTypeDefault, // might be changed later
medium: api.StorageMediumDefault, // might be changed later
mounter: mounter,
mountDetector: mountDetector,
plugin: plugin,
@ -140,7 +140,7 @@ const (
type emptyDir struct {
podUID types.UID
volName string
medium api.StorageType
medium api.StorageMedium
mounter mount.Interface
mountDetector mountDetector
plugin *emptyDirPlugin
@ -159,9 +159,9 @@ func (ed *emptyDir) SetUpAt(dir string) error {
return fmt.Errorf("legacy mode: can not create new instances")
}
switch ed.medium {
case api.StorageTypeDefault:
case api.StorageMediumDefault:
return ed.setupDefault(dir)
case api.StorageTypeMemory:
case api.StorageMediumMemory:
return ed.setupTmpfs(dir)
default:
return fmt.Errorf("unknown storage medium %q", ed.medium)
@ -231,10 +231,10 @@ func (ed *emptyDir) TearDownAt(dir string) error {
return err
}
if isMnt && medium == mediumMemory {
ed.medium = api.StorageTypeMemory
ed.medium = api.StorageMediumMemory
return ed.teardownTmpfs(dir)
}
// assume StorageTypeDefault
// assume StorageMediumDefault
return ed.teardownDefault(dir)
}

View File

@ -70,7 +70,7 @@ func TestPlugin(t *testing.T) {
spec := &api.Volume{
Name: "vol1",
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageTypeDefault}},
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumDefault}},
}
mounter := mount.FakeMounter{}
mountDetector := fakeMountDetector{}
@ -130,7 +130,7 @@ func TestPluginTmpfs(t *testing.T) {
spec := &api.Volume{
Name: "vol1",
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageTypeMemory}},
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumMemory}},
}
mounter := mount.FakeMounter{}
mountDetector := fakeMountDetector{}

View File

@ -89,7 +89,7 @@ func (sv *secretVolume) SetUp() error {
// This is the spec for the volume that this plugin wraps.
var wrappedVolumeSpec = &volume.Spec{
Name: "not-used",
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageTypeMemory}},
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumMemory}},
}
func (sv *secretVolume) SetUpAt(dir string) error {

View File

@ -42,7 +42,7 @@ var _ = Describe("emptyDir", func() {
It("volume on tmpfs should have the correct mode", func() {
volumePath := "/test-volume"
source := &api.EmptyDirVolumeSource{
Medium: api.StorageTypeMemory,
Medium: api.StorageMediumMemory,
}
pod := testPodWithVolume(volumePath, source)
@ -60,7 +60,7 @@ var _ = Describe("emptyDir", func() {
volumePath := "/test-volume"
filePath := path.Join(volumePath, "test-file")
source := &api.EmptyDirVolumeSource{
Medium: api.StorageTypeMemory,
Medium: api.StorageMediumMemory,
}
pod := testPodWithVolume(volumePath, source)