Skip to content

Commit

Permalink
Prevent plugin from returning in-use error for source volumes
Browse files Browse the repository at this point in the history
This addresses a regression in [1] causing plugins to return an in-use
error (FAILED_PRECONDITION) when a sourcing resource (i.e., a snapshot
or a volume) is deleted before the sourced volume is.

[1]: kubernetes-csi#261
  • Loading branch information
timoreimann committed Sep 29, 2020
1 parent 0ddc0e0 commit 5868309
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pkg/sanity/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,14 @@ var _ = DescribeSanity("Controller Service [Controller Server]", func(sc *TestCo
},
},
}
_, err := r.CreateVolume(context.Background(), vol2Req)
volume2, err := r.CreateVolume(context.Background(), vol2Req)
Expect(err).NotTo(HaveOccurred())

// Clean up sourced volume first to prevent plugin from returning an
// in-use error.
By("cleaning up deleting the volume created from snapshot")
delVol2Req := MakeDeleteVolumeReq(sc, volume2.GetVolume().GetVolumeId())
_, err = r.DeleteVolume(context.Background(), delVol2Req)
Expect(err).NotTo(HaveOccurred())
})

Expand Down Expand Up @@ -633,7 +640,14 @@ var _ = DescribeSanity("Controller Service [Controller Server]", func(sc *TestCo
},
},
}
_, err := r.CreateVolume(context.Background(), vol2Req)
volume2, err := r.CreateVolume(context.Background(), vol2Req)
Expect(err).NotTo(HaveOccurred())

// Clean up sourced volume first to prevent plugin from returning an
// in-use error.
By("cleaning up deleting the volume created from source volume")
delVol2Req := MakeDeleteVolumeReq(sc, volume2.GetVolume().GetVolumeId())
_, err = r.DeleteVolume(context.Background(), delVol2Req)
Expect(err).NotTo(HaveOccurred())
})

Expand Down

0 comments on commit 5868309

Please sign in to comment.