Skip to content

cmd/snapshots: add gc.root to created snapshots#2323

Merged
crosbymichael merged 1 commit intocontainerd:masterfrom
stevvooe:ping-snapshots-from-cli
May 4, 2018
Merged

cmd/snapshots: add gc.root to created snapshots#2323
crosbymichael merged 1 commit intocontainerd:masterfrom
stevvooe:ping-snapshots-from-cli

Conversation

@stevvooe
Copy link
Copy Markdown
Member

@stevvooe stevvooe commented May 3, 2018

This adds gc.root label to snapshots created with prepare and commit via
the CLI. WIthout this, created snapshots get immediately garbage
collected. There may be a better solution but this seems to be a solid
stop gap.

We may also need to add more functionality around snapshot labeling for
the CLI but current use cases are unclear.

Signed-off-by: Stephen J Day [email protected]

This adds gc.root label to snapshots created with prepare and commit via
the CLI. WIthout this, created snapshots get immediately garbage
collected. There may be a better solution but this seems to be a solid
stop gap.

We may also need to add more functionality around snapshot labeling for
the CLI but current use cases are unclear.

Signed-off-by: Stephen J Day <[email protected]>
snapshotter := client.SnapshotService(context.GlobalString("snapshotter"))
mounts, err := snapshotter.Prepare(ctx, key, parent)
labels := map[string]string{
"containerd.io/gc.root": time.Now().UTC().Format(time.RFC3339),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have constant (with godoc)?
Probably separate PR though.

@dmcgowan
Copy link
Copy Markdown
Member

dmcgowan commented May 4, 2018

LGTM

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #2323 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2323   +/-   ##
=======================================
  Coverage   45.41%   45.41%           
=======================================
  Files          83       83           
  Lines        9210     9210           
=======================================
  Hits         4183     4183           
  Misses       4351     4351           
  Partials      676      676
Flag Coverage Δ
#linux 49.9% <ø> (ø) ⬆️
#windows 41.24% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cfba048...ed72059. Read the comment docs.

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@crosbymichael crosbymichael merged commit e22c827 into containerd:master May 4, 2018
@stevvooe stevvooe deleted the ping-snapshots-from-cli branch May 24, 2018 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants