From 72cca45db3590d6a69217ab332a2a1eaacda2a8b Mon Sep 17 00:00:00 2001 From: Sirish Bathina Date: Wed, 16 Dec 2020 08:28:33 -1000 Subject: [PATCH] Leftovervsc (#44) * Added image option to fio command * order change of delete --- pkg/csi/snapshot_restore.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/csi/snapshot_restore.go b/pkg/csi/snapshot_restore.go index 2563262..057c3a4 100644 --- a/pkg/csi/snapshot_restore.go +++ b/pkg/csi/snapshot_restore.go @@ -499,13 +499,13 @@ func (c *snapshotCreate) CreateFromSourceCheck(ctx context.Context, snapshotter return err } targetSnapClassName := clonePrefix + args.VolumeSnapshotClass + defer func() { + _ = c.dynCli.Resource(v1alpha1.VolSnapClassGVR).Delete(ctx, targetSnapClassName, metav1.DeleteOptions{}) + }() err := snapshotter.CloneVolumeSnapshotClass(args.VolumeSnapshotClass, targetSnapClassName, kansnapshot.DeletionPolicyRetain, nil) if err != nil { return errors.Wrapf(err, "Failed to create a VolumeSnapshotClass to use to restore the snapshot") } - defer func() { - _ = c.dynCli.Resource(v1alpha1.VolSnapClassGVR).Delete(ctx, targetSnapClassName, metav1.DeleteOptions{}) - }() snapSrc, err := snapshotter.GetSource(ctx, args.SnapshotName, args.Namespace) if err != nil {