Skip to content
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

Avoid duplicated snapshotting, when CSI is enabled #4797

Conversation

blackpiglet
Copy link
Contributor

@blackpiglet blackpiglet commented Mar 31, 2022

Do not take snapshot for PV to avoid duplicated snapshotting, when CSI feature is enabled.

Signed-off-by: Xun Jiang jxun@vmware.com

Thank you for contributing to Velero!

Please add a summary of your change

Does your change fix a particular issue?

Fixes #4758

Please indicate you've done the following:

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

@blackpiglet blackpiglet self-assigned this Mar 31, 2022
@github-actions github-actions bot requested review from jenting and sseago March 31, 2022 09:01
@blackpiglet blackpiglet marked this pull request as draft March 31, 2022 09:03
@blackpiglet blackpiglet marked this pull request as ready for review March 31, 2022 12:09
jenting
jenting previously approved these changes Mar 31, 2022
Copy link
Contributor

@reasonerjt reasonerjt left a comment

Choose a reason for hiding this comment

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

This is problematic because the PV may not be provisioned by CSI driver.

@blackpiglet blackpiglet force-pushed the 4758-avoid-duplicate-snapshot-for-csi branch 2 times, most recently from 1f72ca0 to 7b0704f Compare April 7, 2022 15:02
Fix vmware-tanzu#4758

Do not take snapshot for PV to avoid duplicated snapshotting, when CSI feature is enabled.

Signed-off-by: Xun Jiang <jxun@vmware.com>
@blackpiglet blackpiglet force-pushed the 4758-avoid-duplicate-snapshot-for-csi branch from 7b0704f to 5c74aa2 Compare April 7, 2022 15:32
@blackpiglet
Copy link
Contributor Author

blackpiglet commented Apr 14, 2022

Tried to add some annotations on PV when executing VolumeSnapshot BackupItemAction in backup process, so PV can tell whether it's handled by CSI plugin, but it turned out Velero backup resources according to resources group's name alphabetical order.
That leads to the result that PV is backup before VolumeSnapshot, so it cannot judge by the annotations.
After reading the CSI plugin's PVC BackupItemAction related code, I think the current code should work. CSI plugin doesn't handle PV if its pv.Spec.PersistentVolumeSource.CSI is nil.
I think it should be safe to tell whether this PV should be handled by CSI plugin with this condition:
features.IsEnabled(velerov1api.CSIFeatureFlag) && pv.Spec.CSI != nil

https://github.com/vmware-tanzu/velero-plugin-for-csi/blob/main/internal/backup/pvc_action.go#L82-L85

Copy link
Contributor

@reasonerjt reasonerjt left a comment

Choose a reason for hiding this comment

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

lgtm

@blackpiglet blackpiglet merged commit c115a37 into vmware-tanzu:main Apr 14, 2022
@blackpiglet blackpiglet deleted the 4758-avoid-duplicate-snapshot-for-csi branch October 15, 2022 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

velero v1.8 taking snapshot twice when CSI plugin is enabled.
4 participants