1
0
Fork 0
mirror of https://github.com/kastenhq/kubestr.git synced 2024-12-14 11:57:56 +00:00

Leftovervsc (#44)

* Added image option to fio command

* order change of delete
This commit is contained in:
Sirish Bathina 2020-12-16 08:28:33 -10:00 committed by GitHub
parent 9cbe60d92c
commit 72cca45db3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {