Skip to content

Commit

Permalink
fix(clone): setting properties on the clone volume
Browse files Browse the repository at this point in the history
Signed-off-by: Pawan <pawan@mayadata.io>
pawanpraka1 authored and kmova committed Mar 12, 2020
1 parent fd2ec40 commit ef13014
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/driver/controller.go
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ func CreateZFSClone(req *csi.CreateVolumeRequest, snapshot string) (string, erro
}

if snap.Spec.Capacity != volsize {
return "", status.Error(codes.Internal, "resize not supported")
return "", status.Error(codes.Internal, "clone volume size is not matching")
}

selected := snap.Spec.OwnerNodeID
32 changes: 32 additions & 0 deletions pkg/zfs/zfs_util.go
Original file line number Diff line number Diff line change
@@ -127,9 +127,41 @@ func buildCloneCreateArgs(vol *apis.ZFSVolume) []string {
ZFSVolArg = append(ZFSVolArg, ZFSCloneArg)

if vol.Spec.VolumeType == VOLTYPE_DATASET {
if len(vol.Spec.Capacity) != 0 {
quotaProperty := "quota=" + vol.Spec.Capacity
ZFSVolArg = append(ZFSVolArg, "-o", quotaProperty)
}
if len(vol.Spec.RecordSize) != 0 {
recordsizeProperty := "recordsize=" + vol.Spec.RecordSize
ZFSVolArg = append(ZFSVolArg, "-o", recordsizeProperty)
}
if vol.Spec.ThinProvision == "no" {
reservationProperty := "reservation=" + vol.Spec.Capacity
ZFSVolArg = append(ZFSVolArg, "-o", reservationProperty)
}
ZFSVolArg = append(ZFSVolArg, "-o", "mountpoint=none")
}

if len(vol.Spec.Dedup) != 0 {
dedupProperty := "dedup=" + vol.Spec.Dedup
ZFSVolArg = append(ZFSVolArg, "-o", dedupProperty)
}
if len(vol.Spec.Compression) != 0 {
compressionProperty := "compression=" + vol.Spec.Compression
ZFSVolArg = append(ZFSVolArg, "-o", compressionProperty)
}
if len(vol.Spec.Encryption) != 0 {
encryptionProperty := "encryption=" + vol.Spec.Encryption
ZFSVolArg = append(ZFSVolArg, "-o", encryptionProperty)
}
if len(vol.Spec.KeyLocation) != 0 {
keyLocation := "keylocation=" + vol.Spec.KeyLocation
ZFSVolArg = append(ZFSVolArg, "-o", keyLocation)
}
if len(vol.Spec.KeyFormat) != 0 {
keyFormat := "keyformat=" + vol.Spec.KeyFormat
ZFSVolArg = append(ZFSVolArg, "-o", keyFormat)
}
ZFSVolArg = append(ZFSVolArg, snapshot, volume)
return ZFSVolArg
}

0 comments on commit ef13014

Please sign in to comment.