Style: volumeId -> volumeID

This commit is contained in:
Justin Santa Barbara 2015-04-09 06:34:16 -07:00
parent 98c9ebbc50
commit 933cf60af7
13 changed files with 63 additions and 63 deletions

View File

@ -407,7 +407,7 @@ type ISCSIVolumeSource struct {
// A AWS EBS disk can only be mounted as read/write once.
type AWSElasticBlockStoreVolumeSource struct {
// Unique id of the persistent disk resource. Used to identify the disk in AWS
VolumeId string `json:"volumeId"`
VolumeID string `json:"volumeID"`
// Required: Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs"

View File

@ -315,7 +315,7 @@ type ISCSIVolumeSource struct {
// A AWS PD can only be mounted on a single machine.
type AWSElasticBlockStoreVolumeSource struct {
// Unique id of the PD resource. Used to identify the disk in AWS
VolumeId string `json:"volumeId" description:"unique id of the PD resource in AWS"`
VolumeID string `json:"volumeID" description:"unique id of the PD resource in AWS"`
// Required: Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs"

View File

@ -297,7 +297,7 @@ type GCEPersistentDiskVolumeSource struct {
// A AWS PD can only be mounted on a single machine.
type AWSElasticBlockStoreVolumeSource struct {
// Unique id of the PD resource. Used to identify the disk in AWS
VolumeId string `json:"volumeId" description:"unique id of the PD resource in AWS"`
VolumeID string `json:"volumeID" description:"unique id of the PD resource in AWS"`
// Required: Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs"

View File

@ -413,7 +413,7 @@ type GCEPersistentDiskVolumeSource struct {
// A AWS PD can only be mounted on a single machine.
type AWSElasticBlockStoreVolumeSource struct {
// Unique id of the PD resource. Used to identify the disk in AWS
VolumeId string `json:"volumeId" description:"unique id of the PD resource in AWS"`
VolumeID string `json:"volumeID" description:"unique id of the PD resource in AWS"`
// Required: Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs"

View File

@ -374,8 +374,8 @@ func validateGCEPersistentDiskVolumeSource(PD *api.GCEPersistentDiskVolumeSource
func validateAWSElasticBlockStoreVolumeSource(PD *api.AWSElasticBlockStoreVolumeSource) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if PD.VolumeId == "" {
allErrs = append(allErrs, errs.NewFieldRequired("volumeId"))
if PD.VolumeID == "" {
allErrs = append(allErrs, errs.NewFieldRequired("volumeID"))
}
if PD.FSType == "" {
allErrs = append(allErrs, errs.NewFieldRequired("fsType"))

View File

@ -44,16 +44,16 @@ type EC2 interface {
Instances(instIds []string, filter *ec2InstanceFilter) (resp *ec2.InstancesResp, err error)
// Attach a volume to an instance
AttachVolume(volumeId string, instanceId string, mountDevice string) (resp *ec2.AttachVolumeResp, err error)
AttachVolume(volumeID string, instanceId string, mountDevice string) (resp *ec2.AttachVolumeResp, err error)
// Detach a volume from whatever instance it is attached to
// TODO: We should specify the InstanceID and the Device, for safety
DetachVolume(volumeId string) (resp *ec2.SimpleResp, err error)
DetachVolume(volumeID string) (resp *ec2.SimpleResp, err error)
// Lists volumes
Volumes(volumeIds []string, filter *ec2.Filter) (resp *ec2.VolumesResp, err error)
Volumes(volumeIDs []string, filter *ec2.Filter) (resp *ec2.VolumesResp, err error)
// Create an EBS volume
CreateVolume(request *ec2.CreateVolume) (resp *ec2.CreateVolumeResp, err error)
// Delete an EBS volume
DeleteVolume(volumeId string) (resp *ec2.SimpleResp, err error)
DeleteVolume(volumeID string) (resp *ec2.SimpleResp, err error)
}
// Abstraction over the AWS metadata service
@ -147,24 +147,24 @@ func (self *goamzMetadata) GetMetaData(key string) ([]byte, error) {
type AuthFunc func() (auth aws.Auth, err error)
func (s *goamzEC2) AttachVolume(volumeId string, instanceId string, device string) (resp *ec2.AttachVolumeResp, err error) {
return s.ec2.AttachVolume(volumeId, instanceId, device)
func (s *goamzEC2) AttachVolume(volumeID string, instanceId string, device string) (resp *ec2.AttachVolumeResp, err error) {
return s.ec2.AttachVolume(volumeID, instanceId, device)
}
func (s *goamzEC2) DetachVolume(volumeId string) (resp *ec2.SimpleResp, err error) {
return s.ec2.DetachVolume(volumeId)
func (s *goamzEC2) DetachVolume(volumeID string) (resp *ec2.SimpleResp, err error) {
return s.ec2.DetachVolume(volumeID)
}
func (s *goamzEC2) Volumes(volumeIds []string, filter *ec2.Filter) (resp *ec2.VolumesResp, err error) {
return s.ec2.Volumes(volumeIds, filter)
func (s *goamzEC2) Volumes(volumeIDs []string, filter *ec2.Filter) (resp *ec2.VolumesResp, err error) {
return s.ec2.Volumes(volumeIDs, filter)
}
func (s *goamzEC2) CreateVolume(request *ec2.CreateVolume) (resp *ec2.CreateVolumeResp, err error) {
return s.ec2.CreateVolume(request)
}
func (s *goamzEC2) DeleteVolume(volumeId string) (resp *ec2.SimpleResp, err error) {
return s.ec2.DeleteVolume(volumeId)
func (s *goamzEC2) DeleteVolume(volumeID string) (resp *ec2.SimpleResp, err error) {
return s.ec2.DeleteVolume(volumeID)
}
func init() {
@ -641,7 +641,7 @@ func (self *awsInstance) getInfo() (*ec2.Instance, error) {
// Assigns an unused mount device for the specified volume.
// If the volume is already assigned, this will return the existing mount device and true
func (self *awsInstance) assignMountDevice(volumeId string) (mountDevice string, alreadyAttached bool, err error) {
func (self *awsInstance) assignMountDevice(volumeID string) (mountDevice string, alreadyAttached bool, err error) {
instanceType := self.getInstanceType()
if instanceType == nil {
return "", false, fmt.Errorf("could not get instance type for instance: %s", self.awsID)
@ -661,15 +661,15 @@ func (self *awsInstance) assignMountDevice(volumeId string) (mountDevice string,
}
deviceMappings := map[string]string{}
for _, blockDevice := range info.BlockDevices {
deviceMappings[blockDevice.DeviceName] = blockDevice.VolumeId
deviceMappings[blockDevice.DeviceName] = blockDevice.VolumeID
}
self.deviceMappings = deviceMappings
}
// Check to see if this volume is already assigned a device on this machine
for deviceName, mappingVolumeId := range self.deviceMappings {
if volumeId == mappingVolumeId {
glog.Warningf("Got assignment call for already-assigned volume: %s@%s", deviceName, mappingVolumeId)
for deviceName, mappingVolumeID := range self.deviceMappings {
if volumeID == mappingVolumeID {
glog.Warningf("Got assignment call for already-assigned volume: %s@%s", deviceName, mappingVolumeID)
return deviceName, true, nil
}
}
@ -690,26 +690,26 @@ func (self *awsInstance) assignMountDevice(volumeId string) (mountDevice string,
return "", false, nil
}
self.deviceMappings[chosen] = volumeId
glog.V(2).Infof("Assigned mount device %s -> volume %s", chosen, volumeId)
self.deviceMappings[chosen] = volumeID
glog.V(2).Infof("Assigned mount device %s -> volume %s", chosen, volumeID)
return chosen, false, nil
}
func (self *awsInstance) releaseMountDevice(volumeId string, mountDevice string) {
func (self *awsInstance) releaseMountDevice(volumeID string, mountDevice string) {
self.mutex.Lock()
defer self.mutex.Unlock()
existingVolumeId, found := self.deviceMappings[mountDevice]
existingVolumeID, found := self.deviceMappings[mountDevice]
if !found {
glog.Errorf("releaseMountDevice on non-allocated device")
return
}
if volumeId != existingVolumeId {
if volumeID != existingVolumeID {
glog.Errorf("releaseMountDevice on device assigned to different volume")
return
}
glog.V(2).Infof("Releasing mount device mapping: %s -> volume %s", mountDevice, volumeId)
glog.V(2).Infof("Releasing mount device mapping: %s -> volume %s", mountDevice, volumeID)
delete(self.deviceMappings, mountDevice)
}
@ -938,7 +938,7 @@ func (aws *AWSCloud) CreateVolume(volumeOptions *VolumeOptions) (string, error)
}
az := response.AvailZone
awsID := response.VolumeId
awsID := response.VolumeID
volumeName := "aws://" + az + "/" + awsID

View File

@ -191,15 +191,15 @@ func (self *FakeMetadata) GetMetaData(key string) ([]byte, error) {
}
}
func (ec2 *FakeEC2) AttachVolume(volumeId string, instanceId string, mountDevice string) (resp *ec2.AttachVolumeResp, err error) {
func (ec2 *FakeEC2) AttachVolume(volumeID string, instanceId string, mountDevice string) (resp *ec2.AttachVolumeResp, err error) {
panic("Not implemented")
}
func (ec2 *FakeEC2) DetachVolume(volumeId string) (resp *ec2.SimpleResp, err error) {
func (ec2 *FakeEC2) DetachVolume(volumeID string) (resp *ec2.SimpleResp, err error) {
panic("Not implemented")
}
func (ec2 *FakeEC2) Volumes(volumeIds []string, filter *ec2.Filter) (resp *ec2.VolumesResp, err error) {
func (ec2 *FakeEC2) Volumes(volumeIDs []string, filter *ec2.Filter) (resp *ec2.VolumesResp, err error) {
panic("Not implemented")
}
@ -207,7 +207,7 @@ func (ec2 *FakeEC2) CreateVolume(request *ec2.CreateVolume) (resp *ec2.CreateVol
panic("Not implemented")
}
func (ec2 *FakeEC2) DeleteVolume(volumeId string) (resp *ec2.SimpleResp, err error) {
func (ec2 *FakeEC2) DeleteVolume(volumeID string) (resp *ec2.SimpleResp, err error) {
panic("Not implemented")
}

View File

@ -62,12 +62,12 @@ func isVolumeConflict(volume api.Volume, pod *api.Pod) bool {
}
}
if volume.AWSElasticBlockStore != nil {
volumeId := volume.AWSElasticBlockStore.VolumeId
volumeID := volume.AWSElasticBlockStore.VolumeID
manifest := &(pod.Spec)
for ix := range manifest.Volumes {
if manifest.Volumes[ix].AWSElasticBlockStore != nil &&
manifest.Volumes[ix].AWSElasticBlockStore.VolumeId == volumeId {
manifest.Volumes[ix].AWSElasticBlockStore.VolumeID == volumeID {
return true
}
}

View File

@ -327,7 +327,7 @@ func TestAWSDiskConflicts(t *testing.T) {
{
VolumeSource: api.VolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{
VolumeId: "foo",
VolumeID: "foo",
},
},
},
@ -338,7 +338,7 @@ func TestAWSDiskConflicts(t *testing.T) {
{
VolumeSource: api.VolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{
VolumeId: "bar",
VolumeID: "bar",
},
},
},

View File

@ -77,7 +77,7 @@ func (plugin *awsElasticBlockStorePlugin) NewBuilder(spec *api.Volume, podRef *a
}
func (plugin *awsElasticBlockStorePlugin) newBuilderInternal(spec *api.Volume, podUID types.UID, manager pdManager, mounter mount.Interface) (volume.Builder, error) {
volumeId := spec.AWSElasticBlockStore.VolumeId
volumeID := spec.AWSElasticBlockStore.VolumeID
fsType := spec.AWSElasticBlockStore.FSType
partition := ""
if spec.AWSElasticBlockStore.Partition != 0 {
@ -88,7 +88,7 @@ func (plugin *awsElasticBlockStorePlugin) newBuilderInternal(spec *api.Volume, p
return &awsElasticBlockStore{
podUID: podUID,
volName: spec.Name,
volumeId: volumeId,
volumeID: volumeID,
fsType: fsType,
partition: partition,
readOnly: readOnly,
@ -129,7 +129,7 @@ type awsElasticBlockStore struct {
volName string
podUID types.UID
// Unique id of the PD, used to find the disk resource in the provider.
volumeId string
volumeID string
// Filesystem type, optional.
fsType string
// Specifies the partition to mount
@ -183,7 +183,7 @@ func (pd *awsElasticBlockStore) SetUpAt(dir string) error {
return nil
}
globalPDPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId)
globalPDPath := makeGlobalPDPath(pd.plugin.host, pd.volumeID)
if err := pd.manager.AttachAndMountDisk(pd, globalPDPath); err != nil {
return err
}
@ -232,14 +232,14 @@ func (pd *awsElasticBlockStore) SetUpAt(dir string) error {
return nil
}
func makeGlobalPDPath(host volume.VolumeHost, volumeId string) string {
func makeGlobalPDPath(host volume.VolumeHost, volumeID string) string {
// Clean up the URI to be more fs-friendly
name := volumeId
name := volumeID
name = strings.Replace(name, "://", "/", -1)
return path.Join(host.GetPluginDir(awsElasticBlockStorePluginName), "mounts", name)
}
func getVolumeIdFromGlobalMount(host volume.VolumeHost, globalPath string) (string, error) {
func getVolumeIDFromGlobalMount(host volume.VolumeHost, globalPath string) (string, error) {
basePath := path.Join(host.GetPluginDir(awsElasticBlockStorePluginName), "mounts")
rel, err := filepath.Rel(basePath, globalPath)
if err != nil {
@ -249,12 +249,12 @@ func getVolumeIdFromGlobalMount(host volume.VolumeHost, globalPath string) (stri
return "", fmt.Errorf("Unexpected mount path: " + globalPath)
}
// Reverse the :// replacement done in makeGlobalPDPath
volumeId := rel
if strings.HasPrefix(volumeId, "aws/") {
volumeId = strings.Replace(volumeId, "aws/", "aws://", 1)
volumeID := rel
if strings.HasPrefix(volumeID, "aws/") {
volumeID = strings.Replace(volumeID, "aws/", "aws://", 1)
}
glog.V(2).Info("Mapping mount dir ", globalPath, " to volumeId ", volumeId)
return volumeId, nil
glog.V(2).Info("Mapping mount dir ", globalPath, " to volumeID ", volumeID)
return volumeID, nil
}
func (pd *awsElasticBlockStore) GetPath() string {
@ -294,14 +294,14 @@ func (pd *awsElasticBlockStore) TearDownAt(dir string) error {
// If len(refs) is 1, then all bind mounts have been removed, and the
// remaining reference is the global mount. It is safe to detach.
if len(refs) == 1 {
// pd.volumeId is not initially set for volume-cleaners, so set it here.
pd.volumeId, err = getVolumeIdFromGlobalMount(pd.plugin.host, refs[0])
// pd.volumeID is not initially set for volume-cleaners, so set it here.
pd.volumeID, err = getVolumeIDFromGlobalMount(pd.plugin.host, refs[0])
if err != nil {
glog.V(2).Info("Could not determine volumeId from mountpoint ", refs[0], ": ", err)
glog.V(2).Info("Could not determine volumeID from mountpoint ", refs[0], ": ", err)
return err
}
if err := pd.manager.DetachDisk(pd); err != nil {
glog.V(2).Info("Error detaching disk ", pd.volumeId, ": ", err)
glog.V(2).Info("Error detaching disk ", pd.volumeID, ": ", err)
return err
}
}

View File

@ -72,7 +72,7 @@ type fakePDManager struct{}
// TODO(jonesdl) To fully test this, we could create a loopback device
// and mount that instead.
func (fake *fakePDManager) AttachAndMountDisk(pd *awsElasticBlockStore, globalPDPath string) error {
globalPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId)
globalPath := makeGlobalPDPath(pd.plugin.host, pd.volumeID)
err := os.MkdirAll(globalPath, 0750)
if err != nil {
return err
@ -81,7 +81,7 @@ func (fake *fakePDManager) AttachAndMountDisk(pd *awsElasticBlockStore, globalPD
}
func (fake *fakePDManager) DetachDisk(pd *awsElasticBlockStore) error {
globalPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId)
globalPath := makeGlobalPDPath(pd.plugin.host, pd.volumeID)
err := os.RemoveAll(globalPath)
if err != nil {
return err
@ -101,7 +101,7 @@ func TestPlugin(t *testing.T) {
Name: "vol1",
VolumeSource: api.VolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{
VolumeId: "pd",
VolumeID: "pd",
FSType: "ext4",
},
},

View File

@ -40,7 +40,7 @@ func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsElasticBlockStore, globalPDPa
if pd.readOnly {
flags = mount.FlagReadOnly
}
devicePath, err := volumes.AttachDisk("", pd.volumeId, pd.readOnly)
devicePath, err := volumes.AttachDisk("", pd.volumeID, pd.readOnly)
if err != nil {
return err
}
@ -89,7 +89,7 @@ func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsElasticBlockStore, globalPDPa
// Unmounts the device and detaches the disk from the kubelet's host machine.
func (util *AWSDiskUtil) DetachDisk(pd *awsElasticBlockStore) error {
// Unmount the global PD mount, which should be the only one.
globalPDPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId)
globalPDPath := makeGlobalPDPath(pd.plugin.host, pd.volumeID)
if err := pd.mounter.Unmount(globalPDPath, 0); err != nil {
glog.V(2).Info("Error unmount dir ", globalPDPath, ": ", err)
return err
@ -101,11 +101,11 @@ func (util *AWSDiskUtil) DetachDisk(pd *awsElasticBlockStore) error {
// Detach the disk
volumes, err := pd.getVolumeProvider()
if err != nil {
glog.V(2).Info("Error getting volume provider for volumeId ", pd.volumeId, ": ", err)
glog.V(2).Info("Error getting volume provider for volumeID ", pd.volumeID, ": ", err)
return err
}
if err := volumes.DetachDisk("", pd.volumeId); err != nil {
glog.V(2).Info("Error detaching disk ", pd.volumeId, ": ", err)
if err := volumes.DetachDisk("", pd.volumeID); err != nil {
glog.V(2).Info("Error detaching disk ", pd.volumeID, ": ", err)
return err
}
return nil

View File

@ -275,7 +275,7 @@ func testPDPod(diskName, targetHost string, readOnly bool) *api.Pod {
Name: "testpd",
VolumeSource: api.VolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{
VolumeId: diskName,
VolumeID: diskName,
FSType: "ext4",
ReadOnly: readOnly,
},