Unverified Commit 424d75ad authored by Brian Downs's avatar Brian Downs Committed by GitHub

Merge pull request #3336 from briandowns/issue-3309

Add etcd snapshot save subcommand
parents c824c3bc e8ecc00f
...@@ -17,7 +17,8 @@ func main() { ...@@ -17,7 +17,8 @@ func main() {
cmds.NewEtcdSnapshotSubcommands( cmds.NewEtcdSnapshotSubcommands(
etcdsnapshot.Delete, etcdsnapshot.Delete,
etcdsnapshot.List, etcdsnapshot.List,
etcdsnapshot.Prune), etcdsnapshot.Prune,
etcdsnapshot.Run),
), ),
} }
......
...@@ -48,6 +48,7 @@ func main() { ...@@ -48,6 +48,7 @@ func main() {
cmds.NewEtcdSnapshotSubcommands( cmds.NewEtcdSnapshotSubcommands(
etcdsnapshotCommand, etcdsnapshotCommand,
etcdsnapshotCommand, etcdsnapshotCommand,
etcdsnapshotCommand,
etcdsnapshotCommand), etcdsnapshotCommand),
), ),
} }
......
...@@ -47,7 +47,8 @@ func main() { ...@@ -47,7 +47,8 @@ func main() {
cmds.NewEtcdSnapshotSubcommands( cmds.NewEtcdSnapshotSubcommands(
etcdsnapshot.Delete, etcdsnapshot.Delete,
etcdsnapshot.List, etcdsnapshot.List,
etcdsnapshot.Prune), etcdsnapshot.Prune,
etcdsnapshot.Run),
), ),
} }
......
...@@ -31,7 +31,8 @@ func main() { ...@@ -31,7 +31,8 @@ func main() {
cmds.NewEtcdSnapshotSubcommands( cmds.NewEtcdSnapshotSubcommands(
etcdsnapshot.Delete, etcdsnapshot.Delete,
etcdsnapshot.List, etcdsnapshot.List,
etcdsnapshot.Prune), etcdsnapshot.Prune,
etcdsnapshot.Run),
), ),
} }
......
...@@ -95,7 +95,7 @@ func NewEtcdSnapshotCommand(action func(*cli.Context) error, subcommands []cli.C ...@@ -95,7 +95,7 @@ func NewEtcdSnapshotCommand(action func(*cli.Context) error, subcommands []cli.C
} }
} }
func NewEtcdSnapshotSubcommands(delete, list, prune func(ctx *cli.Context) error) []cli.Command { func NewEtcdSnapshotSubcommands(delete, list, prune, save func(ctx *cli.Context) error) []cli.Command {
return []cli.Command{ return []cli.Command{
{ {
Name: "delete", Name: "delete",
...@@ -127,5 +127,17 @@ func NewEtcdSnapshotSubcommands(delete, list, prune func(ctx *cli.Context) error ...@@ -127,5 +127,17 @@ func NewEtcdSnapshotSubcommands(delete, list, prune func(ctx *cli.Context) error
Value: defaultSnapshotRentention, Value: defaultSnapshotRentention,
}), }),
}, },
{
Name: "save",
Usage: "Trigger an immediate etcd snapshot",
SkipFlagParsing: false,
SkipArgReorder: true,
Action: save,
Flags: append(EtcdSnapshotFlags, &cli.StringFlag{
Name: "dir",
Usage: "(db) Directory to save etcd on-demand snapshot. (default: ${data-dir}/db/snapshots)",
Destination: &ServerConfig.EtcdSnapshotDir,
}),
},
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment