Skip to content

Commit

Permalink
review comment: change the key to ZFSSrcVolKey
Browse files Browse the repository at this point in the history
Signed-off-by: Pawan <[email protected]>
  • Loading branch information
pawanpraka1 committed Nov 11, 2020
1 parent 767f912 commit 3916521
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func CreateVolClone(req *csi.CreateVolumeRequest, srcVol string) (string, error)

selected := vol.Spec.OwnerNodeID

labels := map[string]string{zfs.ZFSVolKey: vol.Name}
labels := map[string]string{zfs.ZFSSrcVolKey: vol.Name}

// create the clone from the source volume

Expand Down
2 changes: 2 additions & 0 deletions pkg/zfs/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const (
ZFSFinalizer string = "zfs.openebs.io/finalizer"
// ZFSVolKey for the ZfsSnapshot CR to store Persistence Volume name
ZFSVolKey string = "openebs.io/persistent-volume"
// ZFSSrcVolKey key for the source Volume name
ZFSSrcVolKey string = "openebs.io/source-volume"
// PoolNameKey is key for ZFS pool name
PoolNameKey string = "openebs.io/poolname"
// ZFSNodeKey will be used to insert Label in ZfsVolume CR
Expand Down
4 changes: 2 additions & 2 deletions pkg/zfs/zfs_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func CreateVolume(vol *apis.ZFSVolume) error {
func CreateClone(vol *apis.ZFSVolume) error {
volume := vol.Spec.PoolName + "/" + vol.Name

if srcVol, ok := vol.Labels[ZFSVolKey]; ok {
if srcVol, ok := vol.Labels[ZFSSrcVolKey]; ok {
// datasource is volume, create the snapshot first
snap := &apis.ZFSSnapshot{}
snap.Name = vol.Name // use volname as snapname
Expand Down Expand Up @@ -601,7 +601,7 @@ func DestroyVolume(vol *apis.ZFSVolume) error {
return err
}

if srcVol, ok := vol.Labels[ZFSVolKey]; ok {
if srcVol, ok := vol.Labels[ZFSSrcVolKey]; ok {
// datasource is volume, delete the dependent snapshot
snap := &apis.ZFSSnapshot{}
snap.Name = vol.Name // snapname is same as volname
Expand Down

0 comments on commit 3916521

Please sign in to comment.