Skip to content

Add support for In-place snapshot restore#353

Merged
ram-infrac merged 4 commits intomasterfrom
snapRestore
Jun 6, 2019
Merged

Add support for In-place snapshot restore#353
ram-infrac merged 4 commits intomasterfrom
snapRestore

Conversation

@ram-infrac
Copy link
Copy Markdown
Contributor

What type of PR is this?
feature

What this PR does / why we need it:
This PR add in-place restore support for volume snapshots. Snapshot now can be restored to origin volumes

Does this PR change a user-facing CRD or CLI?:
We have new CRD for In-place volume snapshot restore.
eg.

apiVersion: stork.libopenstorage.org/v1alpha1
kind: SnapshotRestore
metadata:
    creationTimestamp: null
    name: mysql-group-snap-test123
    namespace: default
spec:
  sourcetype: "local"
  sourcename: "mysql-group-snap"
  sourcenamespace: "default"
  groupsnapshot: true

sourcetype: snapshot type either local or cloud
sourcename: name of snapshot to be restore
groupsnapshot: true if snapshot is volumegroupsnapshot
Is a release note needed?:

Does this change need to be cherry-picked to a release branch?:

@ram-infrac ram-infrac requested a review from disrani-px May 2, 2019 17:50
@ram-infrac ram-infrac changed the title Snap restore Add support for In-place snapshot restore May 2, 2019
@ram-infrac ram-infrac requested a review from sharma-tapas May 6, 2019 07:13
@disrani-px disrani-px added this to the 2.3.0 milestone May 6, 2019
@disrani-px disrani-px added feature The change adds a new feature release-note Information about this change needs to be added to the release note labels May 6, 2019
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 3, 2019

Codecov Report

Merging #353 into master will increase coverage by 0.15%.
The diff coverage is 91.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #353      +/-   ##
==========================================
+ Coverage   74.22%   74.37%   +0.15%     
==========================================
  Files          27       27              
  Lines        2471     2494      +23     
==========================================
+ Hits         1834     1855      +21     
- Misses        479      480       +1     
- Partials      158      159       +1
Impacted Files Coverage Δ
pkg/log/log.go 95.13% <100%> (+0.24%) ⬆️
pkg/extender/extender.go 85.83% <87.5%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee02a05...8d27347. Read the comment docs.

Copy link
Copy Markdown
Contributor

@disrani-px disrani-px left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge after fixing minor comments and adding UT for changes in extender.go

pvc, err := k8s.Instance().GetPersistentVolumeClaim(vol.PersistentVolumeClaim.ClaimName, pod.Namespace)
if err != nil {
msg := "Unable to find PVC %s" + vol.Name
storklog.PodLog(pod).Warnf(msg)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the Event and http.Error(...) got removed when merging the other PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, thanks for pointing out. Do we need to check nil for pod.Spec here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, PodLog() checks for nil

@ram-infrac
Copy link
Copy Markdown
Contributor Author

I have changed UT's for fake k8s client responses, @disrani-px please take look at extender_test.go
Will merge after your re-review for extender_test.go

@disrani-px
Copy link
Copy Markdown
Contributor

@ram-infrac Changes look good!

pvc, err := k8s.Instance().GetPersistentVolumeClaim(vol.PersistentVolumeClaim.ClaimName, pod.Namespace)
if err != nil {
msg := "Unable to find PVC %s" + vol.Name
storklog.PodLog(pod).Warnf(msg)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, PodLog() checks for nil

@disrani-px
Copy link
Copy Markdown
Contributor

Please squash the intermediate commits before merging.

Ram added 4 commits June 6, 2019 10:09
   - codegen generated files
   - Add controller for In-place snapshot restore
   - Add support for local groupsnapshot in-place restore
   - Fix go-lint errors
   - Review comments
   - Check restore status before calling driver's snapshot restore
   - codegen generated files

Signed-off-by: Ram <ram.suradkar@portworx.com>
  - Fix go-lint errors
  - Review comments
  - Generated files for changed volumesnapshotCRD's
  - Restore snapshot where pvc is in use by pods
  - Move controller specific login from portworx driver to snapshot restore
controller
  - Generated files by codegen
  - Review comments

Signed-off-by: Ram <ram.suradkar@portworx.com>
  - address review comments
  - nil check for pvcclaim

Signed-off-by: Ram <ram.suradkar@portworx.com>
   - adjust ut's to create pvc
   - address review comments

Signed-off-by: Ram <ram.suradkar@portworx.com>
@ram-infrac ram-infrac merged commit 0525e3e into master Jun 6, 2019
@ram-infrac ram-infrac deleted the snapRestore branch June 10, 2019 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature The change adds a new feature release-note Information about this change needs to be added to the release note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants