ctr: add ctr snapshot info <key>
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
@@ -27,6 +27,7 @@ var snapshotCommand = cli.Command{
|
||||
treeSnapshotCommand,
|
||||
mountSnapshotCommand,
|
||||
commitSnapshotCommand,
|
||||
infoSnapshotCommand,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -312,6 +313,36 @@ var treeSnapshotCommand = cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var infoSnapshotCommand = cli.Command{
|
||||
Name: "info",
|
||||
Usage: "get info about a snapshot",
|
||||
ArgsUsage: "<key>",
|
||||
Action: func(clicontext *cli.Context) error {
|
||||
ctx, cancel := appContext(clicontext)
|
||||
defer cancel()
|
||||
|
||||
if clicontext.NArg() != 1 {
|
||||
return cli.ShowSubcommandHelp(clicontext)
|
||||
}
|
||||
|
||||
key := clicontext.Args().Get(0)
|
||||
|
||||
snapshotter, err := getSnapshotter(clicontext)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
info, err := snapshotter.Stat(ctx, key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printAsJSON(info)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
type snapshotTreeNode struct {
|
||||
Name string
|
||||
Parent string
|
||||
|
||||
Reference in New Issue
Block a user