Skip to content

Commit

Permalink
tag snapshots at creation (#145)
Browse files Browse the repository at this point in the history
* tag snapshots at creation
  • Loading branch information
jcodybaker authored Apr 22, 2019
1 parent fb1c08d commit cc167ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit cc167ba

Please sign in to comment.