various corrections in pkg/volume

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2022-09-16 16:42:06 +05:30
parent 0f582f7c3f
commit f22a74aa6a
18 changed files with 30 additions and 30 deletions

View File

@ -357,7 +357,7 @@ func TestPlugin(t *testing.T) {
t.Errorf("Failed to GetVolumeName: %v", err)
}
if vName != "test_volume_name/test_configmap_name" {
t.Errorf("Got unexpect VolumeName %v", vName)
t.Errorf("Got unexpected VolumeName %v", vName)
}
volumePath := mounter.GetPath()
@ -481,7 +481,7 @@ func TestPluginOptional(t *testing.T) {
t.Errorf("Failed to GetVolumeName: %v", err)
}
if vName != "test_volume_name/test_configmap_name" {
t.Errorf("Got unexpect VolumeName %v", vName)
t.Errorf("Got unexpected VolumeName %v", vName)
}
volumePath := mounter.GetPath()
@ -580,7 +580,7 @@ func TestPluginKeysOptional(t *testing.T) {
t.Errorf("Failed to GetVolumeName: %v", err)
}
if vName != "test_volume_name/test_configmap_name" {
t.Errorf("Got unexpect VolumeName %v", vName)
t.Errorf("Got unexpected VolumeName %v", vName)
}
volumePath := mounter.GetPath()
@ -660,7 +660,7 @@ func TestInvalidConfigMapSetup(t *testing.T) {
t.Errorf("Failed to GetVolumeName: %v", err)
}
if vName != "test_volume_name/test_configmap_name" {
t.Errorf("Got unexpect VolumeName %v", vName)
t.Errorf("Got unexpected VolumeName %v", vName)
}
volumePath := mounter.GetPath()

View File

@ -219,7 +219,7 @@ func TestBlockMapperSetupDevice(t *testing.T) {
if err != nil {
t.Fatalf("failed to setup VolumeAttachment: %v", err)
}
t.Log("created attachement ", attachID)
t.Log("created attachment ", attachID)
stagingPath, err := csiMapper.SetUpDevice()
if err != nil {
@ -260,7 +260,7 @@ func TestBlockMapperSetupDeviceError(t *testing.T) {
if err != nil {
t.Fatalf("failed to setup VolumeAttachment: %v", err)
}
t.Log("created attachement ", attachID)
t.Log("created attachment ", attachID)
stagingPath, err := csiMapper.SetUpDevice()
if err == nil {
@ -304,7 +304,7 @@ func TestBlockMapperMapPodDevice(t *testing.T) {
if err != nil {
t.Fatalf("failed to setup VolumeAttachment: %v", err)
}
t.Log("created attachement ", attachID)
t.Log("created attachment ", attachID)
// Map device to global and pod device map path
path, err := csiMapper.MapPodDevice()
@ -495,7 +495,7 @@ func TestVolumeSetupTeardown(t *testing.T) {
if err != nil {
t.Fatalf("failed to setup VolumeAttachment: %v", err)
}
t.Log("created attachement ", attachID)
t.Log("created attachment ", attachID)
stagingPath, err := csiMapper.SetUpDevice()
if err != nil {

View File

@ -22,7 +22,7 @@ import (
utilversion "k8s.io/apimachinery/pkg/util/version"
)
// Driver is a description of a CSI Driver, defined by an enpoint and the
// Driver is a description of a CSI Driver, defined by an endpoint and the
// highest CSI version supported
type Driver struct {
endpoint string

View File

@ -86,7 +86,7 @@ func (mc *metricsCsi) GetMetrics() (*volume.Metrics, error) {
return metrics, nil
}
// MetricsManager defines the metrics mananger for CSI operation
// MetricsManager defines the metrics manager for CSI operation
type MetricsManager struct {
driverName string
}

View File

@ -987,7 +987,7 @@ func TestPluginCanAttach(t *testing.T) {
pluginCanAttach, err := plug.CanAttach(test.spec)
if err != nil && !test.shouldFail {
t.Fatalf("unexected plugin.CanAttach error: %s", err)
t.Fatalf("unexpected plugin.CanAttach error: %s", err)
}
if pluginCanAttach != test.canAttach {
t.Fatalf("expecting plugin.CanAttach %t got %t", test.canAttach, pluginCanAttach)
@ -1062,7 +1062,7 @@ func TestPluginFindAttachablePlugin(t *testing.T) {
plugin, err := plugMgr.FindAttachablePluginBySpec(test.spec)
if err != nil && !test.shouldFail {
t.Fatalf("unexected error calling pluginMgr.FindAttachablePluginBySpec: %s", err)
t.Fatalf("unexpected error calling pluginMgr.FindAttachablePluginBySpec: %s", err)
}
if (plugin != nil) != test.canAttach {
t.Fatal("expecting attachable plugin, but got nil")

View File

@ -203,7 +203,7 @@ func TestCSI_VolumeAll(t *testing.T) {
shouldFail: true,
},
{
name: "incompete spec",
name: "incomplete spec",
specName: "pv2",
driver: "simple-driver",
volName: "vol2",
@ -434,7 +434,7 @@ func TestCSI_VolumeAll(t *testing.T) {
dataFile := filepath.Join(filepath.Dir(mounter.GetPath()), volDataFileName)
if _, err := os.Stat(dataFile); err != nil {
t.Fatalf("csiTest.VolumeAll meatadata JSON file not found: %s", dataFile)
t.Fatalf("csiTest.VolumeAll metadata JSON file not found: %s", dataFile)
}
t.Log("csiTest.VolumeAll JSON datafile generated OK:", dataFile)

View File

@ -163,7 +163,7 @@ func TestNodeExpand(t *testing.T) {
}
}
// verify device staging targer path
// verify device staging target path
stagingTargetPath := fakeNodeClient.FakeNodeExpansionRequest.GetStagingTargetPath()
if tc.deviceStagePath != "" && tc.deviceStagePath != stagingTargetPath {
t.Errorf("For %s: expected staging path %s got %s", tc.name, tc.deviceStagePath, stagingTargetPath)

View File

@ -288,7 +288,7 @@ func (plugin *fcPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volu
// ConstructBlockVolumeSpec creates a new volume.Spec with following steps.
// - Searches a file whose name is {pod uuid} under volume plugin directory.
// - If a file is found, then retreives volumePluginDependentPath from globalMapPathUUID.
// - If a file is found, then retrieves volumePluginDependentPath from globalMapPathUUID.
// - Once volumePluginDependentPath is obtained, store volume information to VolumeSource
//
// examples:

View File

@ -211,7 +211,7 @@ func searchDisk(b fcDiskMounter) (string, error) {
diskIDs = wwids
}
rescaned := false
rescanned := false
// two-phase search:
// first phase, search existing device path, if a multipath dm is found, exit loop
// otherwise, in second phase, rescan scsi bus and search again, return with any findings
@ -228,13 +228,13 @@ func searchDisk(b fcDiskMounter) (string, error) {
}
}
// if a dm is found, exit loop
if rescaned || dm != "" {
if rescanned || dm != "" {
break
}
// rescan and search again
// rescan scsi bus
scsiHostRescan(io)
rescaned = true
rescanned = true
}
// if no disk matches input wwn and lun, exit
if disk == "" && dm == "" {

View File

@ -38,7 +38,7 @@ func NewCachedMetrics(provider MetricsProvider) MetricsProvider {
return &cachedMetrics{wrapped: provider}
}
// GetMetrics runs the wrapped metrics provider's GetMetrics methd once and
// GetMetrics runs the wrapped metrics provider's GetMetrics method once and
// caches the result. Will not cache result if there is an error.
// See MetricsProvider.GetMetrics
func (md *cachedMetrics) GetMetrics() (*Metrics, error) {

View File

@ -284,7 +284,7 @@ func createDriverClient(hostname string, port int32) (*osdclient.Client, error)
// getPortworxDriver returns a Portworx volume driver which can be used for cluster wide operations.
//
// Operations like create and delete volume don't need to be restricted to local volume host since
// any node in the Portworx cluster can co-ordinate the create/delete request and forward the operations to
// any node in the Portworx cluster can coordinate the create/delete request and forward the operations to
// the Portworx node that will own/owns the data.
func (util *portworxVolumeUtil) getPortworxDriver(volumeHost volume.VolumeHost) (volumeapi.VolumeDriver, error) {
// check if existing saved client is valid

View File

@ -770,7 +770,7 @@ func (r *rbdVolumeDeleter) Delete() error {
return r.manager.DeleteImage(r)
}
// rbd implmenets volume.Volume interface.
// rbd implements volume.Volume interface.
// It's embedded in Mounter/Unmounter/Deleter.
type rbd struct {
volName string

View File

@ -52,7 +52,7 @@ func (handler *deviceHandler) FindMultipathDeviceForDevice(device string) string
return ""
}
// findDeviceForPath Find the underlaying disk for a linked path such as /dev/disk/by-path/XXXX or /dev/mapper/XXXX
// findDeviceForPath Find the underlying disk for a linked path such as /dev/disk/by-path/XXXX or /dev/mapper/XXXX
// will return sdX or hdX etc, if /dev/sdX is passed in then sdX will be returned
func findDeviceForPath(path string, io IoUtil) (string, error) {
devicePath, err := io.EvalSymlinks(path)

View File

@ -737,7 +737,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
// At this point, MountVolume.Setup already succeeded, we should add volume into actual state
// so that reconciler can clean up volume when needed. However, volume resize failed,
// we should not mark the volume as mounted to avoid pod starts using it.
// Considering the above situations, we mark volume as uncertain here so that reconciler will tigger
// Considering the above situations, we mark volume as uncertain here so that reconciler will trigger
// volume tear down when pod is deleted, and also makes sure pod will not start using it.
if err := actualStateOfWorld.MarkVolumeMountAsUncertain(markOpts); err != nil {
klog.Errorf(volumeToMount.GenerateErrorDetailed("MountVolume.MarkVolumeMountAsUncertain failed", err).Error())
@ -1237,7 +1237,7 @@ func (og *operationGenerator) GenerateMapVolumeFunc(
// At this point, MountVolume.Setup already succeeded, we should add volume into actual state
// so that reconciler can clean up volume when needed. However, if nodeExpandVolume failed,
// we should not mark the volume as mounted to avoid pod starts using it.
// Considering the above situations, we mark volume as uncertain here so that reconciler will tigger
// Considering the above situations, we mark volume as uncertain here so that reconciler will trigger
// volume tear down when pod is deleted, and also makes sure pod will not start using it.
if err := actualStateOfWorld.MarkVolumeMountAsUncertain(markVolumeOpts); err != nil {
klog.Errorf(volumeToMount.GenerateErrorDetailed("MountVolume.MarkVolumeMountAsUncertain failed", err).Error())

View File

@ -125,7 +125,7 @@ func evalSymlink(path string) (string, error) {
klog.V(4).Infof("Path '%s' has a target %s. Return its original form.", path, linkedPath)
return path, nil
}
// If the target is not an absoluate path, join iit with the current upperpath
// If the target is not an absolute path, join iit with the current upperpath
if !filepath.IsAbs(linkedPath) {
linkedPath = filepath.Join(getUpperPath(upperpath), linkedPath)
}

View File

@ -42,9 +42,9 @@ type BlockVolumePathHandler interface {
UnmapDevice(mapPath string, linkName string, bindMount bool) error
// RemovePath removes a file or directory on specified map path
RemoveMapPath(mapPath string) error
// IsSymlinkExist retruns true if specified symbolic link exists
// IsSymlinkExist returns true if specified symbolic link exists
IsSymlinkExist(mapPath string) (bool, error)
// IsDeviceBindMountExist retruns true if specified bind mount exists
// IsDeviceBindMountExist returns true if specified bind mount exists
IsDeviceBindMountExist(mapPath string) (bool, error)
// GetDeviceBindMountRefs searches bind mounts under global map path
GetDeviceBindMountRefs(devPath string, mapPath string) ([]string, error)

View File

@ -103,7 +103,7 @@ func TestValidatePathNoBacksteps(t *testing.T) {
err := ValidatePathNoBacksteps(tc.path)
if err == nil && tc.expectedErr {
t.Fatalf("expected test `%s` to return an error but it didnt", name)
t.Fatalf("expected test `%s` to return an error but it didn't", name)
}
if err != nil && !tc.expectedErr {

View File

@ -189,7 +189,7 @@ type CustomBlockVolumeMapper interface {
// MapPodDevice maps the block device to a path and return the path.
// Unique device path across kubelet node reboot is required to avoid
// unexpected block volume destruction.
// If empty string is returned, the path retuned by attacher.Attach() and
// If empty string is returned, the path returned by attacher.Attach() and
// attacher.WaitForAttach() will be used.
MapPodDevice() (publishPath string, err error)