support using multiple snapshotters simultaneously
e.g. dist pull --snapshotter btrfs ...; ctr run --snapshotter btrfs ... (empty string defaults for overlayfs) Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp> Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
committed by
Michael Crosby
parent
8f1c11d862
commit
b06aab713a
@@ -19,6 +19,7 @@ import (
|
||||
var snapshotCommand = cli.Command{
|
||||
Name: "snapshot",
|
||||
Usage: "snapshot management",
|
||||
Flags: snapshotterFlags,
|
||||
Subcommands: cli.Commands{
|
||||
archiveSnapshotCommand,
|
||||
listSnapshotCommand,
|
||||
@@ -79,13 +80,11 @@ var listSnapshotCommand = cli.Command{
|
||||
ctx, cancel := appContext(clicontext)
|
||||
defer cancel()
|
||||
|
||||
client, err := newClient(clicontext)
|
||||
snapshotter, err := getSnapshotter(clicontext)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
snapshotter := client.SnapshotService()
|
||||
|
||||
tw := tabwriter.NewWriter(os.Stdout, 1, 8, 1, ' ', 0)
|
||||
fmt.Fprintln(tw, "ID\tParent\tState\tReadonly\t")
|
||||
|
||||
@@ -125,11 +124,6 @@ var usageSnapshotCommand = cli.Command{
|
||||
ctx, cancel := appContext(clicontext)
|
||||
defer cancel()
|
||||
|
||||
client, err := newClient(clicontext)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var displaySize func(int64) string
|
||||
if clicontext.Bool("b") {
|
||||
displaySize = func(s int64) string {
|
||||
@@ -141,7 +135,10 @@ var usageSnapshotCommand = cli.Command{
|
||||
}
|
||||
}
|
||||
|
||||
snapshotter := client.SnapshotService()
|
||||
snapshotter, err := getSnapshotter(clicontext)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tw := tabwriter.NewWriter(os.Stdout, 1, 8, 1, ' ', 0)
|
||||
fmt.Fprintln(tw, "ID\tSize\tInodes\t")
|
||||
@@ -180,13 +177,11 @@ var removeSnapshotCommand = cli.Command{
|
||||
ctx, cancel := appContext(clicontext)
|
||||
defer cancel()
|
||||
|
||||
client, err := newClient(clicontext)
|
||||
snapshotter, err := getSnapshotter(clicontext)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
snapshotter := client.SnapshotService()
|
||||
|
||||
for _, id := range clicontext.Args() {
|
||||
err = snapshotter.Remove(ctx, id)
|
||||
if err != nil {
|
||||
@@ -219,12 +214,11 @@ var prepareSnapshotCommand = cli.Command{
|
||||
|
||||
logrus.Infof("preparing mounts %s", dgst.String())
|
||||
|
||||
client, err := newClient(clicontext)
|
||||
snapshotter, err := getSnapshotter(clicontext)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
snapshotter := client.SnapshotService()
|
||||
mounts, err := snapshotter.Prepare(ctx, target, dgst.String())
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user