refact(error): handle errors (#326)

Signed-off-by: aSquare14 <atibhi.a@gmail.com>
This commit is contained in:
Atibhi Agrawal 2021-05-06 17:07:43 +05:30 committed by GitHub
parent 62b3a0b7fe
commit 137572552e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -288,6 +288,9 @@ func CreateVolClone(ctx context.Context, req *csi.CreateVolumeRequest, srcVol st
WithName(volName).
WithVolumeStatus(zfs.ZFSStatusPending).
WithLabels(labels).Build()
if err != nil {
return "", err
}
volObj.Spec = vol.Spec
// use the snapshot name same as new volname
@ -342,6 +345,9 @@ func CreateSnapClone(ctx context.Context, req *csi.CreateVolumeRequest, snapshot
WithName(volName).
WithVolumeStatus(zfs.ZFSStatusPending).
Build()
if err != nil {
return "", err
}
volObj.Spec = snap.Spec
volObj.Spec.SnapName = strings.ToLower(snapshot)