From 07f200dab11526c7a63948177caa0857db345634 Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Mon, 22 Apr 2019 18:30:48 -0400 Subject: [PATCH] tag snapshots at creation (#145) * tag snapshots at creation --- driver/controller.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/driver/controller.go b/driver/controller.go index e6a6487b0..113ad2e10 100644 --- a/driver/controller.go +++ b/driver/controller.go @@ -631,11 +631,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