From f22a74aa6a76518a6af5d9c13b3186f50b41c0b2 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Fri, 16 Sep 2022 16:42:06 +0530 Subject: [PATCH] various corrections in pkg/volume Signed-off-by: Humble Chirammal --- pkg/volume/configmap/configmap_test.go | 8 ++++---- pkg/volume/csi/csi_block_test.go | 8 ++++---- pkg/volume/csi/csi_drivers_store.go | 2 +- pkg/volume/csi/csi_metrics.go | 2 +- pkg/volume/csi/csi_plugin_test.go | 4 ++-- pkg/volume/csi/csi_test.go | 4 ++-- pkg/volume/csi/expander_test.go | 2 +- pkg/volume/fc/fc.go | 2 +- pkg/volume/fc/fc_util.go | 6 +++--- pkg/volume/metrics_cached.go | 2 +- pkg/volume/portworx/portworx_util.go | 2 +- pkg/volume/rbd/rbd.go | 2 +- pkg/volume/util/device_util_linux.go | 2 +- pkg/volume/util/operationexecutor/operation_generator.go | 4 ++-- pkg/volume/util/subpath/subpath_windows.go | 2 +- pkg/volume/util/volumepathhandler/volume_path_handler.go | 4 ++-- pkg/volume/validation/pv_validation_test.go | 2 +- pkg/volume/volume.go | 2 +- 18 files changed, 30 insertions(+), 30 deletions(-) diff --git a/pkg/volume/configmap/configmap_test.go b/pkg/volume/configmap/configmap_test.go index 7f793e13a40..ee5d2d73913 100644 --- a/pkg/volume/configmap/configmap_test.go +++ b/pkg/volume/configmap/configmap_test.go @@ -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() diff --git a/pkg/volume/csi/csi_block_test.go b/pkg/volume/csi/csi_block_test.go index d5ff75d3af7..3a3d153f293 100644 --- a/pkg/volume/csi/csi_block_test.go +++ b/pkg/volume/csi/csi_block_test.go @@ -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 { diff --git a/pkg/volume/csi/csi_drivers_store.go b/pkg/volume/csi/csi_drivers_store.go index 70bfd1b383d..96c44c5beea 100644 --- a/pkg/volume/csi/csi_drivers_store.go +++ b/pkg/volume/csi/csi_drivers_store.go @@ -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 diff --git a/pkg/volume/csi/csi_metrics.go b/pkg/volume/csi/csi_metrics.go index 7315222e613..b61e2fd2813 100644 --- a/pkg/volume/csi/csi_metrics.go +++ b/pkg/volume/csi/csi_metrics.go @@ -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 } diff --git a/pkg/volume/csi/csi_plugin_test.go b/pkg/volume/csi/csi_plugin_test.go index b23c043cdc0..fbabaf4b37a 100644 --- a/pkg/volume/csi/csi_plugin_test.go +++ b/pkg/volume/csi/csi_plugin_test.go @@ -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") diff --git a/pkg/volume/csi/csi_test.go b/pkg/volume/csi/csi_test.go index a7f751305eb..7aa5e39c46a 100644 --- a/pkg/volume/csi/csi_test.go +++ b/pkg/volume/csi/csi_test.go @@ -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) diff --git a/pkg/volume/csi/expander_test.go b/pkg/volume/csi/expander_test.go index 44660305bb7..bb12cd6fdc6 100644 --- a/pkg/volume/csi/expander_test.go +++ b/pkg/volume/csi/expander_test.go @@ -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) diff --git a/pkg/volume/fc/fc.go b/pkg/volume/fc/fc.go index 8c8920d6dc2..6c90ed0deae 100644 --- a/pkg/volume/fc/fc.go +++ b/pkg/volume/fc/fc.go @@ -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: diff --git a/pkg/volume/fc/fc_util.go b/pkg/volume/fc/fc_util.go index 9dab1514c5c..f14641d4dc2 100644 --- a/pkg/volume/fc/fc_util.go +++ b/pkg/volume/fc/fc_util.go @@ -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 == "" { diff --git a/pkg/volume/metrics_cached.go b/pkg/volume/metrics_cached.go index ac0dc9b7a57..3aef3d20639 100644 --- a/pkg/volume/metrics_cached.go +++ b/pkg/volume/metrics_cached.go @@ -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) { diff --git a/pkg/volume/portworx/portworx_util.go b/pkg/volume/portworx/portworx_util.go index 8f014c1940e..32b40ecf257 100644 --- a/pkg/volume/portworx/portworx_util.go +++ b/pkg/volume/portworx/portworx_util.go @@ -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 diff --git a/pkg/volume/rbd/rbd.go b/pkg/volume/rbd/rbd.go index adb4e61376c..ec399624366 100644 --- a/pkg/volume/rbd/rbd.go +++ b/pkg/volume/rbd/rbd.go @@ -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 diff --git a/pkg/volume/util/device_util_linux.go b/pkg/volume/util/device_util_linux.go index 4fc3291dbee..66ac77835c3 100644 --- a/pkg/volume/util/device_util_linux.go +++ b/pkg/volume/util/device_util_linux.go @@ -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) diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index 79c232d85ce..13348a54bc0 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -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()) diff --git a/pkg/volume/util/subpath/subpath_windows.go b/pkg/volume/util/subpath/subpath_windows.go index e7f77d07f75..c8a3a6b7f56 100644 --- a/pkg/volume/util/subpath/subpath_windows.go +++ b/pkg/volume/util/subpath/subpath_windows.go @@ -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) } diff --git a/pkg/volume/util/volumepathhandler/volume_path_handler.go b/pkg/volume/util/volumepathhandler/volume_path_handler.go index 3009eb34f46..1de7c52a55d 100644 --- a/pkg/volume/util/volumepathhandler/volume_path_handler.go +++ b/pkg/volume/util/volumepathhandler/volume_path_handler.go @@ -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) diff --git a/pkg/volume/validation/pv_validation_test.go b/pkg/volume/validation/pv_validation_test.go index d7601185b99..45e3792678f 100644 --- a/pkg/volume/validation/pv_validation_test.go +++ b/pkg/volume/validation/pv_validation_test.go @@ -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 { diff --git a/pkg/volume/volume.go b/pkg/volume/volume.go index 75c2d906151..9afd0484a2b 100644 --- a/pkg/volume/volume.go +++ b/pkg/volume/volume.go @@ -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)