mirror of
https://github.com/containers/podman.git
synced 2025-10-18 03:33:32 +08:00
Unconditionally retrieve pod names via API
The ListContainers API previously had a Pod parameter, which determined if pod name was returned (but, notably, not Pod ID, which was returned unconditionally). This was fairly confusing, so we decided to deprecate/remove the parameter and return it unconditionally. To do this without serious performance implications, we need to avoid expensive JSON decodes of pod configuration in the DB. The way our Bolt tables are structured, retrieving name given ID is actually quite cheap, but we did not expose this via the Libpod API. Add a new GetName API to do this. Fixes #7214 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
@ -41,7 +41,6 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
|
||||
Last int `schema:"last"` // alias for limit
|
||||
Limit int `schema:"limit"`
|
||||
Namespace bool `schema:"namespace"`
|
||||
Pod bool `schema:"pod"`
|
||||
Size bool `schema:"size"`
|
||||
Sync bool `schema:"sync"`
|
||||
}{
|
||||
@ -72,7 +71,7 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
|
||||
Size: query.Size,
|
||||
Sort: "",
|
||||
Namespace: query.Namespace,
|
||||
Pod: query.Pod,
|
||||
Pod: true,
|
||||
Sync: query.Sync,
|
||||
}
|
||||
pss, err := ps.GetContainerLists(runtime, opts)
|
||||
|
@ -661,11 +661,10 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
|
||||
// type: boolean
|
||||
// description: Include namespace information
|
||||
// default: false
|
||||
// - in: query
|
||||
// name: pod
|
||||
// type: boolean
|
||||
// default: false
|
||||
// description: Include Pod ID and Name if applicable
|
||||
// description: Ignored. Previously included details on pod name and ID that are currently included by default.
|
||||
// - in: query
|
||||
// name: size
|
||||
// type: boolean
|
||||
|
Reference in New Issue
Block a user