From 2bebe981c146a5fefe2c4525ea90eb3ba77328d2 Mon Sep 17 00:00:00 2001 From: sivakumar subraani Date: Wed, 3 May 2023 19:11:26 +0000 Subject: [PATCH] pb-3831: In csi driver CancelRestore, cleaning up dangling PVC, if restore is not succeed and retain as well --- drivers/volume/csi/csi.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/volume/csi/csi.go b/drivers/volume/csi/csi.go index a1c495a670..dcabbe5aa5 100644 --- a/drivers/volume/csi/csi.go +++ b/drivers/volume/csi/csi.go @@ -1683,7 +1683,10 @@ func (c *csi) CancelRestore(restore *storkapi.ApplicationRestore) error { if vrInfo.DriverName != storkvolume.CSIDriverName { continue } - pvcRestoreSucceeded := (vrInfo.Status == storkapi.ApplicationRestoreStatusPartialSuccess || vrInfo.Status == storkapi.ApplicationRestoreStatusSuccessful) + // For existing volume, the status will be retained. + pvcRestoreSucceeded := (vrInfo.Status == storkapi.ApplicationRestoreStatusPartialSuccess || + vrInfo.Status == storkapi.ApplicationRestoreStatusSuccessful || + vrInfo.Status == storkapi.ApplicationRestoreStatusRetained) // Only clean up dangling PVC if it's restore did not succeed if !pvcRestoreSucceeded {