-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(snapshot): add support for thin snapshot for lvm volumes #102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prateekpandey14 suggested a few changes.
215e983
to
a2fec24
Compare
@@ -518,6 +523,17 @@ func lvThinExists(vg string, name string) bool { | |||
return name == strings.TrimSpace(string(out)) | |||
} | |||
|
|||
// snapshotExists checks if a snapshot volume exists given the name of the volume. | |||
func isSnapshotExists(vg, snapVolumeName string) (bool, error) { | |||
cmd := exec.Command("lvs", vg+"/"+snapVolumeName, "--noheadings", "-o", "lv_name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is required , since thin-snapshot can not be found in /dev/vol-group/snapshot-id
path using os.State()
.
a2fec24
to
02a7d73
Compare
thin snapshot will be created only for thin volumes Signed-off-by: prateekpandey14 <[email protected]>
02a7d73
to
d285676
Compare
Signed-off-by: prateekpandey14 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: prateekpandey14 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good.
@prateekpandey14 can we update the doc with this paramater and its behavior? |
Signed-off-by: prateekpandey14 [email protected]
Pull Request template
Why is this PR required? What issue does it fix?:
To support thin snapshot for lvm volumes
What this PR does?:
Add support for thin snapshot for lvm volumes based on the SnapSize configured in SnapshotClass.
So there are two scenarios here :
1. Snapshot class
snapsize
parameter.In this case whether volume is thin provisioned or thick provisioned, we should create a thick snapshot with size as
snapsize
mentioned in the snapshotclass.2. Snapshot class does not have
snapsize
parameterIn this case, for thin volumes, we should create a thin snapshot and for thick volume, we should create a thick snapshot.
While creating the thick snapshot for thick volumes, since snapsize parameter is not provided, driver should reserve size equal to the volume for snapshots.
Does this PR require any upgrade changes?:
No
Checklist:
<type>(<scope>): <subject>