Skip to content

Commit

Permalink
fix(region): panic occured when removing post overlay (#22008)
Browse files Browse the repository at this point in the history
  • Loading branch information
zexi authored Jan 21, 2025
1 parent 3e96ee5 commit a94dddc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/compute/models/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1175,11 +1175,14 @@ func (c *SContainer) PerformRemoveVolumeMountPostOverlay(ctx context.Context, us

func (c *SContainer) removePostOverlay(vmd *apis.ContainerVolumeMountDisk, ov *apis.ContainerVolumeMountDiskPostOverlay) *apis.ContainerVolumeMountDisk {
curOvs := vmd.PostOverlay
for i, cov := range curOvs {
resultOvs := []*apis.ContainerVolumeMountDiskPostOverlay{}
for i := range curOvs {
cov := curOvs[i]
if cov.IsEqual(*ov) {
curOvs = append(curOvs[:i], curOvs[i+1:]...)
continue
}
resultOvs = append(resultOvs, cov)
}
vmd.PostOverlay = curOvs
vmd.PostOverlay = resultOvs
return vmd
}

0 comments on commit a94dddc

Please sign in to comment.