mirror of
https://github.com/containers/podman.git
synced 2025-10-25 02:04:43 +08:00
Merge pull request #16371 from alexlarsson/transient-store
Support transient store mode
This commit is contained in:
@ -464,6 +464,8 @@ func rootFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
|
||||
pFlags.StringVar(&podmanConfig.Runroot, runrootFlagName, "", "Path to the 'run directory' where all state information is stored")
|
||||
_ = cmd.RegisterFlagCompletionFunc(runrootFlagName, completion.AutocompleteDefault)
|
||||
|
||||
pFlags.BoolVar(&podmanConfig.TransientStore, "transient-store", false, "Enable transient container storage")
|
||||
|
||||
runtimeFlagName := "runtime"
|
||||
pFlags.StringVar(&podmanConfig.RuntimePath, runtimeFlagName, podmanConfig.ContainersConfDefaultsRO.Engine.OCIRuntime, "Path to the OCI-compatible binary used to run containers.")
|
||||
_ = cmd.RegisterFlagCompletionFunc(runtimeFlagName, completion.AutocompleteDefault)
|
||||
|
||||
@ -47,6 +47,7 @@ func init() {
|
||||
flags := pruneCommand.Flags()
|
||||
flags.BoolVarP(&force, "force", "f", false, "Do not prompt for confirmation. The default is false")
|
||||
flags.BoolVarP(&pruneOptions.All, "all", "a", false, "Remove all unused data")
|
||||
flags.BoolVar(&pruneOptions.External, "external", false, "Remove container data in storage not controlled by podman")
|
||||
flags.BoolVar(&pruneOptions.Volume, "volumes", false, "Prune volumes")
|
||||
filterFlagName := "filter"
|
||||
flags.StringArrayVar(&filters, filterFlagName, []string{}, "Provide filter values (e.g. 'label=<key>=<value>')")
|
||||
@ -55,8 +56,8 @@ func init() {
|
||||
|
||||
func prune(cmd *cobra.Command, args []string) error {
|
||||
var err error
|
||||
// Prompt for confirmation if --force is not set
|
||||
if !force {
|
||||
// Prompt for confirmation if --force is not set, unless --external
|
||||
if !force && !pruneOptions.External {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
volumeString := ""
|
||||
if pruneOptions.Volume {
|
||||
@ -113,7 +114,9 @@ func prune(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("Total reclaimed space: %s\n", units.HumanSize((float64)(response.ReclaimedSpace)))
|
||||
if !pruneOptions.External {
|
||||
fmt.Printf("Total reclaimed space: %s\n", units.HumanSize((float64)(response.ReclaimedSpace)))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user