Remove volumesNeedReportedInUse for reconstructed volumes

This commit is contained in:
carlory 2024-05-21 18:23:12 +08:00
parent 8c1983ffc0
commit 2491560ae5
4 changed files with 0 additions and 23 deletions

View File

@ -62,11 +62,4 @@ func (rc *reconciler) reconcile() {
// This will start reconciliation of node.status.volumesInUse.
rc.updateLastSyncTime()
}
if len(rc.volumesNeedReportedInUse) != 0 && rc.populatorHasAddedPods() {
// Once DSW is populated, mark all reconstructed as reported in node.status,
// so they can proceed with MountDevice / SetUp.
rc.desiredStateOfWorld.MarkVolumesReportedInUse(rc.volumesNeedReportedInUse)
rc.volumesNeedReportedInUse = nil
}
}

View File

@ -119,7 +119,6 @@ func NewReconciler(
timeOfLastSync: time.Time{},
volumesFailedReconstruction: make([]podVolume, 0),
volumesNeedUpdateFromNodeStatus: make([]v1.UniqueVolumeName, 0),
volumesNeedReportedInUse: make([]v1.UniqueVolumeName, 0),
}
}
@ -143,7 +142,6 @@ type reconciler struct {
timeOfLastSync time.Time
volumesFailedReconstruction []podVolume
volumesNeedUpdateFromNodeStatus []v1.UniqueVolumeName
volumesNeedReportedInUse []v1.UniqueVolumeName
}
func (rc *reconciler) unmountVolumes() {

View File

@ -91,9 +91,6 @@ func (rc *reconciler) reconstructVolumes() {
// Add the volumes to ASW
rc.updateStates(reconstructedVolumes)
// The reconstructed volumes are mounted, hence a previous kubelet must have already put it into node.status.volumesInUse.
// Remember to update DSW with this information.
rc.volumesNeedReportedInUse = reconstructedVolumeNames
// Remember to update devicePath from node.status.volumesAttached
rc.volumesNeedUpdateFromNodeStatus = reconstructedVolumeNames
}

View File

@ -36,7 +36,6 @@ func TestReconstructVolumes(t *testing.T) {
tests := []struct {
name string
volumePaths []string
expectedVolumesNeedReportedInUse []string
expectedVolumesNeedDevicePath []string
expectedVolumesFailedReconstruction []string
verifyFunc func(rcInstance *reconciler, fakePlugin *volumetesting.FakeVolumePlugin) error
@ -47,7 +46,6 @@ func TestReconstructVolumes(t *testing.T) {
filepath.Join("pod1", "volumes", "fake-plugin", "pvc-abcdef"),
filepath.Join("pod2", "volumes", "fake-plugin", "pvc-abcdef"),
},
expectedVolumesNeedReportedInUse: []string{"fake-plugin/pvc-abcdef", "fake-plugin/pvc-abcdef"},
expectedVolumesNeedDevicePath: []string{"fake-plugin/pvc-abcdef", "fake-plugin/pvc-abcdef"},
expectedVolumesFailedReconstruction: []string{},
verifyFunc: func(rcInstance *reconciler, fakePlugin *volumetesting.FakeVolumePlugin) error {
@ -75,7 +73,6 @@ func TestReconstructVolumes(t *testing.T) {
volumePaths: []string{
filepath.Join("pod1", "volumes", "missing-plugin", "pvc-abcdef"),
},
expectedVolumesNeedReportedInUse: []string{},
expectedVolumesNeedDevicePath: []string{},
expectedVolumesFailedReconstruction: []string{"pvc-abcdef"},
},
@ -117,14 +114,6 @@ func TestReconstructVolumes(t *testing.T) {
t.Errorf("Expected expectedVolumesNeedDevicePath:\n%v\n got:\n%v", expectedVolumes, rcInstance.volumesNeedUpdateFromNodeStatus)
}
expectedVolumes = make([]v1.UniqueVolumeName, len(tc.expectedVolumesNeedReportedInUse))
for i := range tc.expectedVolumesNeedReportedInUse {
expectedVolumes[i] = v1.UniqueVolumeName(tc.expectedVolumesNeedReportedInUse[i])
}
if !reflect.DeepEqual(expectedVolumes, rcInstance.volumesNeedReportedInUse) {
t.Errorf("Expected volumesNeedReportedInUse:\n%v\n got:\n%v", expectedVolumes, rcInstance.volumesNeedReportedInUse)
}
volumesFailedReconstruction := sets.NewString()
for _, vol := range rcInstance.volumesFailedReconstruction {
volumesFailedReconstruction.Insert(vol.volumeSpecName)