diff --git a/pkg/volume/csi/expander_test.go b/pkg/volume/csi/expander_test.go index 12c10f5a892..32af09b928b 100644 --- a/pkg/volume/csi/expander_test.go +++ b/pkg/volume/csi/expander_test.go @@ -32,7 +32,6 @@ func TestNodeExpand(t *testing.T) { name string nodeExpansion bool nodeStageSet bool - volumePhase volume.CSIVolumePhaseType success bool fsVolume bool grpcError error @@ -47,37 +46,26 @@ func TestNodeExpand(t *testing.T) { name: "when nodeExpansion=on, nodeStage=on, volumePhase=staged", nodeExpansion: true, nodeStageSet: true, - volumePhase: volume.CSIVolumeStaged, success: true, fsVolume: true, deviceStagePath: "/foo/bar", }, - { - name: "when nodeExpansion=on, nodeStage=off, volumePhase=staged", - nodeExpansion: true, - volumePhase: volume.CSIVolumeStaged, - success: false, - fsVolume: true, - }, { name: "when nodeExpansion=on, nodeStage=on, volumePhase=published", nodeExpansion: true, nodeStageSet: true, - volumePhase: volume.CSIVolumePublished, success: true, fsVolume: true, }, { name: "when nodeExpansion=on, nodeStage=off, volumePhase=published", nodeExpansion: true, - volumePhase: volume.CSIVolumePublished, success: true, fsVolume: true, }, { name: "when nodeExpansion=on, nodeStage=off, volumePhase=published, fsVolume=false", nodeExpansion: true, - volumePhase: volume.CSIVolumePublished, success: true, fsVolume: false, }, @@ -85,7 +73,6 @@ func TestNodeExpand(t *testing.T) { name: "when nodeExpansion=on, nodeStage=on, volumePhase=published has grpc volume-in-use error", nodeExpansion: true, nodeStageSet: true, - volumePhase: volume.CSIVolumePublished, success: false, fsVolume: true, grpcError: status.Error(codes.FailedPrecondition, "volume-in-use"), @@ -95,7 +82,6 @@ func TestNodeExpand(t *testing.T) { name: "when nodeExpansion=on, nodeStage=on, volumePhase=published has other grpc error", nodeExpansion: true, nodeStageSet: true, - volumePhase: volume.CSIVolumePublished, success: false, fsVolume: true, grpcError: status.Error(codes.InvalidArgument, "invalid-argument"), @@ -117,7 +103,6 @@ func TestNodeExpand(t *testing.T) { DeviceMountPath: "/foo/bar", DeviceStagePath: "/foo/bar", DevicePath: "/mnt/foobar", - CSIVolumePhase: tc.volumePhase, } csiSource, _ := getCSISourceFromSpec(resizeOptions.VolumeSpec) csClient := setupClientWithExpansion(t, tc.nodeStageSet, tc.nodeExpansion) diff --git a/pkg/volume/plugins.go b/pkg/volume/plugins.go index 56deebbcd13..47234e99de4 100644 --- a/pkg/volume/plugins.go +++ b/pkg/volume/plugins.go @@ -53,9 +53,6 @@ type ProbeEvent struct { Op ProbeOperation // The operation to the plugin } -// CSIVolumePhaseType stores information about CSI volume path. -type CSIVolumePhaseType string - const ( // Common parameter which can be specified in StorageClass to specify the desired FSType // Provisioners SHOULD implement support for this if they are block device based @@ -65,8 +62,6 @@ const ( ProbeAddOrUpdate ProbeOperation = 1 << iota ProbeRemove - CSIVolumeStaged CSIVolumePhaseType = "staged" - CSIVolumePublished CSIVolumePhaseType = "published" ) var ( @@ -124,9 +119,6 @@ type NodeResizeOptions struct { NewSize resource.Quantity OldSize resource.Quantity - - // CSIVolumePhase contains volume phase on the node - CSIVolumePhase CSIVolumePhaseType } type DynamicPluginProber interface { diff --git a/pkg/volume/testing/testing.go b/pkg/volume/testing/testing.go index 6b7c5a98dbe..401a335f4b8 100644 --- a/pkg/volume/testing/testing.go +++ b/pkg/volume/testing/testing.go @@ -478,12 +478,7 @@ func (plugin *FakeVolumePlugin) NodeExpand(resizeOptions NodeResizeOptions) (boo return false, fmt.Errorf("Test failure: NodeExpand") } - // Set up fakeVolumePlugin not support STAGE_UNSTAGE for testing the behavior - // so as volume can be node published before we can resize - if resizeOptions.CSIVolumePhase == volume.CSIVolumeStaged { - return false, nil - } - if resizeOptions.CSIVolumePhase == volume.CSIVolumePublished && resizeOptions.VolumeSpec.Name() == FailVolumeExpansion { + if resizeOptions.VolumeSpec.Name() == FailVolumeExpansion { return false, fmt.Errorf("fail volume expansion for volume: %s", FailVolumeExpansion) } return true, nil diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index 106b3ee47d8..265fc0f6b5a 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -710,7 +710,6 @@ func (og *operationGenerator) GenerateMountVolumeFunc( } klog.V(verbosity).InfoS(detailedMsg, "pod", klog.KObj(volumeToMount.Pod)) resizeOptions.DeviceMountPath = volumeMounter.GetPath() - resizeOptions.CSIVolumePhase = volume.CSIVolumePublished _, resizeError = og.nodeExpandVolume(volumeToMount, actualStateOfWorld, resizeOptions) if resizeError != nil { @@ -1204,7 +1203,6 @@ func (og *operationGenerator) GenerateMapVolumeFunc( resizeOptions := volume.NodeResizeOptions{ DevicePath: devicePath, DeviceStagePath: stagingPath, - CSIVolumePhase: volume.CSIVolumePublished, } _, resizeError := og.nodeExpandVolume(volumeToMount, actualStateOfWorld, resizeOptions) if resizeError != nil { @@ -1974,7 +1972,6 @@ func (og *operationGenerator) GenerateExpandInUseVolumeFunc( } // if we are doing online expansion then volume is already published - resizeOptions.CSIVolumePhase = volume.CSIVolumePublished resizeDone, eventErr, detailedErr = og.doOnlineExpansion(volumeToMount, actualStateOfWorld, resizeOptions) if eventErr != nil || detailedErr != nil { return volumetypes.NewOperationContext(eventErr, detailedErr, migrated)