Skip to content

tag snapshots at creation #145

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

Merged
merged 2 commits into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
[[GH-143]](https://github.com/digitalocean/csi-digitalocean/pull/143)
* Fix race in snapshot integration test.
[[GH-146]](https://github.com/digitalocean/csi-digitalocean/pull/146)
* Add tagging support for Volume snapshots via the new `--do-tag` flag
[[GH-145]](https://github.com/digitalocean/csi-digitalocean/pull/145)

## v1.0.0 - 2018.12.19

Expand Down
9 changes: 7 additions & 2 deletions driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,16 @@ func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequ
}
}

snap, resp, err := d.storage.CreateSnapshot(ctx, &godo.SnapshotCreateRequest{
snapReq := &godo.SnapshotCreateRequest{
VolumeID: req.GetSourceVolumeId(),
Name: req.GetName(),
Description: createdByDO,
})
}
if d.doTag != "" {
snapReq.Tags = append(snapReq.Tags, d.doTag)
}

snap, resp, err := d.storage.CreateSnapshot(ctx, snapReq)
if err != nil {
if resp != nil && resp.StatusCode == http.StatusConflict {
// 409 is returned when we try to snapshot a volume with the same
Expand Down