diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-05-04 13:20:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 13:20:09 -0400 |
commit | ad93318370c8201367ef80042a3c91ff50389e16 (patch) | |
tree | 2c4301b7d232e5a895d7463a21b8c2b59cc9fb0a /cmd/podman/system | |
parent | 5c8277d943afdfd62f5713672f389abf2ad8b097 (diff) | |
parent | 80744c644135899a6dcc9fbe1b421dc08fc79802 (diff) | |
download | podman-ad93318370c8201367ef80042a3c91ff50389e16.tar.gz podman-ad93318370c8201367ef80042a3c91ff50389e16.tar.bz2 podman-ad93318370c8201367ef80042a3c91ff50389e16.zip |
Merge pull request #14066 from ashley-cui/sysres
podman system reset removed machines incorrectly
Diffstat (limited to 'cmd/podman/system')
-rw-r--r-- | cmd/podman/system/reset.go | 10 | ||||
-rw-r--r-- | cmd/podman/system/reset_machine.go | 13 | ||||
-rw-r--r-- | cmd/podman/system/reset_machine_unsupported.go | 8 |
3 files changed, 30 insertions, 1 deletions
diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go index 8f2e73375..176573bf6 100644 --- a/cmd/podman/system/reset.go +++ b/cmd/podman/system/reset.go @@ -61,7 +61,9 @@ func reset(cmd *cobra.Command, args []string) { - all pods - all images - all networks - - all build cache`) + - all build cache + - all machines`) + if len(listCtn) > 0 { fmt.Println(`WARNING! The following external containers will be purged:`) // print first 12 characters of ID and first configured name alias @@ -103,5 +105,11 @@ func reset(cmd *cobra.Command, args []string) { //nolint:gocritic os.Exit(define.ExecErrorCodeGeneric) } + + // Shutdown podman-machine and delete all machine files + if err := resetMachine(); err != nil { + logrus.Error(err) + } + os.Exit(0) } diff --git a/cmd/podman/system/reset_machine.go b/cmd/podman/system/reset_machine.go new file mode 100644 index 000000000..a07b4fb83 --- /dev/null +++ b/cmd/podman/system/reset_machine.go @@ -0,0 +1,13 @@ +//go:build (amd64 && !remote) || (arm64 && !remote) +// +build amd64,!remote arm64,!remote + +package system + +import ( + cmdMach "github.com/containers/podman/v4/cmd/podman/machine" +) + +func resetMachine() error { + provider := cmdMach.GetSystemDefaultProvider() + return provider.RemoveAndCleanMachines() +} diff --git a/cmd/podman/system/reset_machine_unsupported.go b/cmd/podman/system/reset_machine_unsupported.go new file mode 100644 index 000000000..e063cd089 --- /dev/null +++ b/cmd/podman/system/reset_machine_unsupported.go @@ -0,0 +1,8 @@ +//go:build !amd64 && !arm64 +// +build !amd64,!arm64 + +package system + +func resetMachine() error { + return nil +} |