Change:
When a pod is quickly deleted and re-created on a node, it may not be necessary to unstage the volume and in which case only node-publish is called for the volume. When this happens - stagepath won't be set for RPC call because volume was not staged even though, volume does have capability. We should try and fix this behaviour so that - nodestagepath is always set in RPC call. We should try and fix this behaviour so that - nodestagepath is always set in RPC call. Quickly delete and recreate a pod No response master Any No response_ <details</details<details</details<details</details
/sig storage /triage accepted

Discussion:
resizeOptions.DeviceStagePath = deviceMountPath } <ins> if volumeDeviceMounter != nil && resizeOptions.DeviceStagePath == "" { deviceStagePath, err := volumeDeviceMounter.GetDeviceMountPath(volumeToMount.VolumeSpec) if err != nil { // On failure, return error. Caller will log and retry. eventErr, detailedErr := volumeToMount.GenerateError("MountVolume.GetDeviceMountPath failed for expansion", err) return volumetypes.NewOperationContext(eventErr, detailedErr, migrated) } resizeOptions.DeviceStagePath = deviceStagePath } </ins> // No mapping is needed for hostUID/hostGID if userns is not used. // Therefore, just assign the container users to host UID/GID. hostUID := util.FsUserFrom(volumeToMount.Pod)

expansionFailed expansionFailedOnController expansionFailedOnNode <ins> expansionFailedMissingStagingPath </ins> ) const (

nodeExpansionRequired   bool disableAttach           bool disableResizingOnDriver bool <ins> simulatedCSIDriverError expansionStatus </ins> expectFailure           bool }{ { <del> name:                  "should expand volume without restarting pod if nodeExpansion=off", nodeExpansionRequired: false, </del> <ins> name:                    "should expand volume without restarting pod if nodeExpansion=off", nodeExpansionRequired:   false, simulatedCSIDriverError: expansionSuccess, }, { name:                    "should expand volume by restarting pod if attach=on, nodeExpansion=on", nodeExpansionRequired:   true, simulatedCSIDriverError: expansionSuccess, </ins> }, { <del> name:                  "should expand volume by restarting pod if attach=on, nodeExpansion=on", nodeExpansionRequired: true, </del> <ins> name:                    "should not have staging_path missing in node expand volume pod if attach=on, nodeExpansion=on", nodeExpansionRequired:   true, simulatedCSIDriverError: expansionFailedMissingStagingPath, </ins> }, { <del> name:                  "should expand volume by restarting pod if attach=off, nodeExpansion=on", disableAttach:         true, nodeExpansionRequired: true, </del> <ins> name:                    "should expand volume by restarting pod if attach=off, nodeExpansion=on", disableAttach:           true, nodeExpansionRequired:   true, simulatedCSIDriverError: expansionSuccess, </ins> }, { name:                    "should not expand volume if resizingOnDriver=off, resizingOnSC=on", disableResizingOnDriver: true, expectFailure:           true, <ins> simulatedCSIDriverError: expansionSuccess, </ins> }, } for _, t := range tests {

tp.disableAttach = true tp.registerDriver = true } <ins> tp.hooks = createExpansionHook(test.simulatedCSIDriverError) </ins> m.init(ctx, tp) ginkgo.DeferCleanup(m.cleanup)

} ginkgo.By("Deleting the previously created pod") <del> err = e2epod.DeletePodWithWait(ctx, m.cs, pod) framework.ExpectNoError(err, "while deleting pod for resizing") </del> <ins> if test.simulatedCSIDriverError == expansionFailedMissingStagingPath { e2epod.DeletePodOrFail(ctx, m.cs, pod.Namespace, pod.Name) } else { err = e2epod.DeletePodWithWait(ctx, m.cs, pod) framework.ExpectNoError(err, "while deleting pod for resizing") } </ins> ginkgo.By("Creating a new pod with same volume") pod2, err := m.createPodWithPVC(pvc)

return &drivers.Hooks{ Pre: func(ctx context.Context, method string, request interface{}) (reply interface{}, err error) { switch expectedExpansionStatus { <ins> case expansionFailedMissingStagingPath: expansionRequest, ok := request.(*csipbv1.NodeExpandVolumeRequest) if ok { stagingPath := expansionRequest.StagingTargetPath if stagingPath == "" { return nil, status.Error(codes.InvalidArgument, "invalid node expansion request, missing staging path") } } </ins> case expansionFailedOnController: expansionRequest, ok := request.(*csipbv1.ControllerExpandVolumeRequest) if ok {