summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/libpod/system.go10
-rw-r--r--pkg/api/server/register_system.go15
2 files changed, 24 insertions, 1 deletions
diff --git a/pkg/api/handlers/libpod/system.go b/pkg/api/handlers/libpod/system.go
index 98e33bf10..72a38db63 100644
--- a/pkg/api/handlers/libpod/system.go
+++ b/pkg/api/handlers/libpod/system.go
@@ -69,3 +69,13 @@ func SystemPrune(w http.ResponseWriter, r *http.Request) {
}
utils.WriteResponse(w, http.StatusOK, systemPruneReport)
}
+
+// SystemReset Resets podman storage back to default state
+func SystemReset(w http.ResponseWriter, r *http.Request) {
+ err := r.Context().Value("runtime").(*libpod.Runtime).Reset(r.Context())
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ utils.WriteResponse(w, http.StatusOK, nil)
+}
diff --git a/pkg/api/server/register_system.go b/pkg/api/server/register_system.go
index 7375a75c1..39990e6a6 100644
--- a/pkg/api/server/register_system.go
+++ b/pkg/api/server/register_system.go
@@ -27,6 +27,19 @@ func (s *APIServer) registerSystemHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/system/prune"), s.APIHandler(libpod.SystemPrune)).Methods(http.MethodPost)
-
+ // swagger:operation POST /libpod/system/reset libpod resetSystem
+ // ---
+ // tags:
+ // - system
+ // summary: Reset podman storage
+ // description: All containers will be stopped and removed, and all images, volumes and container content will be removed.
+ // produces:
+ // - application/json
+ // responses:
+ // 200:
+ // description: no error
+ // 500:
+ // $ref: "#/responses/InternalError"
+ r.Handle(VersionedPath("/libpod/system/reset"), s.APIHandler(libpod.SystemReset)).Methods(http.MethodPost)
return nil
}