Skip to content

Commit e9374a1

Browse files
committed
tag snapshots at creation (#145)
* tag snapshots at creation
1 parent 62c2428 commit e9374a1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

driver/controller.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -631,11 +631,16 @@ func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequ
631631
}
632632
}
633633

634-
snap, resp, err := d.storage.CreateSnapshot(ctx, &godo.SnapshotCreateRequest{
634+
snapReq := &godo.SnapshotCreateRequest{
635635
VolumeID: req.GetSourceVolumeId(),
636636
Name: req.GetName(),
637637
Description: createdByDO,
638-
})
638+
}
639+
if d.doTag != "" {
640+
snapReq.Tags = append(snapReq.Tags, d.doTag)
641+
}
642+
643+
snap, resp, err := d.storage.CreateSnapshot(ctx, snapReq)
639644
if err != nil {
640645
if resp != nil && resp.StatusCode == http.StatusConflict {
641646
// 409 is returned when we try to snapshot a volume with the same

0 commit comments

Comments
 (0)