Skip to content

velero doesn't correctly handle an empty ProviderSnapshotID #9429

@kayrus

Description

@kayrus

What steps did you take and what happened:

In case, when the snapshot is not created correctly on the API level and CreateSnapshot returns an error (e.g. quota limit issue), velero still tries to delete a snapshot with empty ProviderSnapshotID

velero-plugin-openstack returns an empty string and an error: https://github.com/Lirt/velero-plugin-for-openstack/blob/edc05cfa95f000a82233079e4396bca36375324d/src/cinder/block_store.go#L556-L560

the error just logged and the snapshotID is not set

snapshotID, err := volumeSnapshotter.CreateSnapshot(snapshot.Spec.ProviderVolumeID, snapshot.Spec.VolumeAZ, tags)
if err != nil {
errs = append(errs, errors.Wrap(err, "error taking snapshot of volume"))
snapshot.Status.Phase = volume.SnapshotPhaseFailed
} else {
snapshot.Status.Phase = volume.SnapshotPhaseCompleted
snapshot.Status.ProviderSnapshotID = snapshotID
}

then an empty snapshotID is being passed to the velero plugin

if err := volumeSnapshotter.DeleteSnapshot(snapshot.Status.ProviderSnapshotID); err != nil {
errs = append(errs, errors.Wrapf(err, "error deleting snapshot %s", snapshot.Status.ProviderSnapshotID).Error())
}

We see a number of snapshot delete calls with an empty snapshotID, all of them produce 404, and correctly handled by the plugin, but these API calls can be avoided if velero handle them correctly and skip the DeleteSnapshot call.

What did you expect to happen:

I expect velero to handle an empty snapshot.Status.ProviderSnapshotID string correctly and don't call the volumeSnapshotter.DeleteSnapshot() with an empty argument.

Alternatively I can implement a check for an empty snapshotID in the velero plugin code, but this seems to be a temporary hook, not a final solution.

Environment:

  • Velero version (use velero version): 1.16.2
  • Velero features (use velero client config get features):
  • Kubernetes version (use kubectl version):
  • Kubernetes installer & version:
  • Cloud provider or hardware configuration: OpenStack
  • OS (e.g. from /etc/os-release):

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.

  • 👍 for "I would like to see this bug fixed as soon as possible"
  • 👎 for "There are more important bugs to focus on right now"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions