mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +08:00
Add "died" event
We have a new event for container 'Exited' which has been renamed to 'died'. also removed the stream bool from the varlink endpoint for events because it can be determined by the varlink more value. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
61
API.md
61
API.md
@ -43,9 +43,13 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in
|
|||||||
|
|
||||||
[func GetContainerStats(name: string) ContainerStats](#GetContainerStats)
|
[func GetContainerStats(name: string) ContainerStats](#GetContainerStats)
|
||||||
|
|
||||||
|
[func GetContainerStatsWithHistory(previousStats: ContainerStats) ContainerStats](#GetContainerStatsWithHistory)
|
||||||
|
|
||||||
[func GetContainersByContext(all: bool, latest: bool, args: []string) []string](#GetContainersByContext)
|
[func GetContainersByContext(all: bool, latest: bool, args: []string) []string](#GetContainersByContext)
|
||||||
|
|
||||||
[func GetEvents(options: EventInput) Event](#GetEvents)
|
[func GetContainersLogs(names: []string, follow: bool, latest: bool, since: string, tail: int, timestamps: bool) LogLine](#GetContainersLogs)
|
||||||
|
|
||||||
|
[func GetEvents(filter: []string, since: string, until: string) Event](#GetEvents)
|
||||||
|
|
||||||
[func GetImage(id: string) Image](#GetImage)
|
[func GetImage(id: string) Image](#GetImage)
|
||||||
|
|
||||||
@ -133,6 +137,8 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in
|
|||||||
|
|
||||||
[func TagImage(name: string, tagged: string) string](#TagImage)
|
[func TagImage(name: string, tagged: string) string](#TagImage)
|
||||||
|
|
||||||
|
[func TopPod(pod: string, latest: bool, descriptors: []string) []string](#TopPod)
|
||||||
|
|
||||||
[func UnmountContainer(name: string, force: bool) ](#UnmountContainer)
|
[func UnmountContainer(name: string, force: bool) ](#UnmountContainer)
|
||||||
|
|
||||||
[func UnpauseContainer(name: string) string](#UnpauseContainer)
|
[func UnpauseContainer(name: string) string](#UnpauseContainer)
|
||||||
@ -169,8 +175,6 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in
|
|||||||
|
|
||||||
[type Event](#Event)
|
[type Event](#Event)
|
||||||
|
|
||||||
[type EventInput](#EventInput)
|
|
||||||
|
|
||||||
[type IDMap](#IDMap)
|
[type IDMap](#IDMap)
|
||||||
|
|
||||||
[type IDMappingOptions](#IDMappingOptions)
|
[type IDMappingOptions](#IDMappingOptions)
|
||||||
@ -199,6 +203,8 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in
|
|||||||
|
|
||||||
[type ListPodData](#ListPodData)
|
[type ListPodData](#ListPodData)
|
||||||
|
|
||||||
|
[type LogLine](#LogLine)
|
||||||
|
|
||||||
[type MoreResponse](#MoreResponse)
|
[type MoreResponse](#MoreResponse)
|
||||||
|
|
||||||
[type NotImplemented](#NotImplemented)
|
[type NotImplemented](#NotImplemented)
|
||||||
@ -237,8 +243,6 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in
|
|||||||
|
|
||||||
[error RuntimeError](#RuntimeError)
|
[error RuntimeError](#RuntimeError)
|
||||||
|
|
||||||
[error StreamEnded](#StreamEnded)
|
|
||||||
|
|
||||||
[error VolumeNotFound](#VolumeNotFound)
|
[error VolumeNotFound](#VolumeNotFound)
|
||||||
|
|
||||||
[error WantsMoreRequired](#WantsMoreRequired)
|
[error WantsMoreRequired](#WantsMoreRequired)
|
||||||
@ -472,6 +476,12 @@ $ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
~~~
|
~~~
|
||||||
|
### <a name="GetContainerStatsWithHistory"></a>func GetContainerStatsWithHistory
|
||||||
|
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
||||||
|
|
||||||
|
method GetContainerStatsWithHistory(previousStats: [ContainerStats](#ContainerStats)) [ContainerStats](#ContainerStats)</div>
|
||||||
|
GetContainerStatsWithHistory takes a previous set of container statistics and uses libpod functions
|
||||||
|
to calculate the containers statistics based on current and previous measurements.
|
||||||
### <a name="GetContainersByContext"></a>func GetContainersByContext
|
### <a name="GetContainersByContext"></a>func GetContainersByContext
|
||||||
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
||||||
|
|
||||||
@ -479,10 +489,15 @@ method GetContainersByContext(all: [bool](https://godoc.org/builtin#bool), lates
|
|||||||
GetContainersByContext allows you to get a list of container ids depending on all, latest, or a list of
|
GetContainersByContext allows you to get a list of container ids depending on all, latest, or a list of
|
||||||
container names. The definition of latest container means the latest by creation date. In a multi-
|
container names. The definition of latest container means the latest by creation date. In a multi-
|
||||||
user environment, results might differ from what you expect.
|
user environment, results might differ from what you expect.
|
||||||
|
### <a name="GetContainersLogs"></a>func GetContainersLogs
|
||||||
|
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
||||||
|
|
||||||
|
method GetContainersLogs(names: [[]string](#[]string), follow: [bool](https://godoc.org/builtin#bool), latest: [bool](https://godoc.org/builtin#bool), since: [string](https://godoc.org/builtin#string), tail: [int](https://godoc.org/builtin#int), timestamps: [bool](https://godoc.org/builtin#bool)) [LogLine](#LogLine)</div>
|
||||||
|
|
||||||
### <a name="GetEvents"></a>func GetEvents
|
### <a name="GetEvents"></a>func GetEvents
|
||||||
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
||||||
|
|
||||||
method GetEvents(options: [EventInput](#EventInput)) [Event](#Event)</div>
|
method GetEvents(filter: [[]string](#[]string), since: [string](https://godoc.org/builtin#string), until: [string](https://godoc.org/builtin#string)) [Event](#Event)</div>
|
||||||
GetEvents returns known libpod events filtered by the options provided.
|
GetEvents returns known libpod events filtered by the options provided.
|
||||||
### <a name="GetImage"></a>func GetImage
|
### <a name="GetImage"></a>func GetImage
|
||||||
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
||||||
@ -714,7 +729,7 @@ See also [GetContainer](#GetContainer).
|
|||||||
|
|
||||||
method ListImages() [Image](#Image)</div>
|
method ListImages() [Image](#Image)</div>
|
||||||
ListImages returns information about the images that are currently in storage.
|
ListImages returns information about the images that are currently in storage.
|
||||||
See also [InspectImage](InspectImage).
|
See also [InspectImage](#InspectImage).
|
||||||
### <a name="ListPods"></a>func ListPods
|
### <a name="ListPods"></a>func ListPods
|
||||||
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
||||||
|
|
||||||
@ -976,6 +991,11 @@ $ varlink call -m unix:/run/podman/io.podman/io.podman.StopPod '{"name": "135d71
|
|||||||
method TagImage(name: [string](https://godoc.org/builtin#string), tagged: [string](https://godoc.org/builtin#string)) [string](https://godoc.org/builtin#string)</div>
|
method TagImage(name: [string](https://godoc.org/builtin#string), tagged: [string](https://godoc.org/builtin#string)) [string](https://godoc.org/builtin#string)</div>
|
||||||
TagImage takes the name or ID of an image in local storage as well as the desired tag name. If the image cannot
|
TagImage takes the name or ID of an image in local storage as well as the desired tag name. If the image cannot
|
||||||
be found, an [ImageNotFound](#ImageNotFound) error will be returned; otherwise, the ID of the image is returned on success.
|
be found, an [ImageNotFound](#ImageNotFound) error will be returned; otherwise, the ID of the image is returned on success.
|
||||||
|
### <a name="TopPod"></a>func TopPod
|
||||||
|
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
||||||
|
|
||||||
|
method TopPod(pod: [string](https://godoc.org/builtin#string), latest: [bool](https://godoc.org/builtin#bool), descriptors: [[]string](#[]string)) [[]string](#[]string)</div>
|
||||||
|
|
||||||
### <a name="UnmountContainer"></a>func UnmountContainer
|
### <a name="UnmountContainer"></a>func UnmountContainer
|
||||||
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
||||||
|
|
||||||
@ -1426,17 +1446,6 @@ status [string](https://godoc.org/builtin#string)
|
|||||||
time [string](https://godoc.org/builtin#string)
|
time [string](https://godoc.org/builtin#string)
|
||||||
|
|
||||||
type [string](https://godoc.org/builtin#string)
|
type [string](https://godoc.org/builtin#string)
|
||||||
### <a name="EventInput"></a>type EventInput
|
|
||||||
|
|
||||||
EventInput describes the input to obtain libpod events
|
|
||||||
|
|
||||||
filter [[]string](#[]string)
|
|
||||||
|
|
||||||
since [string](https://godoc.org/builtin#string)
|
|
||||||
|
|
||||||
stream [bool](https://godoc.org/builtin#bool)
|
|
||||||
|
|
||||||
until [string](https://godoc.org/builtin#string)
|
|
||||||
### <a name="IDMap"></a>type IDMap
|
### <a name="IDMap"></a>type IDMap
|
||||||
|
|
||||||
IDMap is used to describe user name spaces during container creation
|
IDMap is used to describe user name spaces during container creation
|
||||||
@ -1636,6 +1645,19 @@ labels [map[string]](#map[string])
|
|||||||
numberofcontainers [string](https://godoc.org/builtin#string)
|
numberofcontainers [string](https://godoc.org/builtin#string)
|
||||||
|
|
||||||
containersinfo [ListPodContainerInfo](#ListPodContainerInfo)
|
containersinfo [ListPodContainerInfo](#ListPodContainerInfo)
|
||||||
|
### <a name="LogLine"></a>type LogLine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
device [string](https://godoc.org/builtin#string)
|
||||||
|
|
||||||
|
parseLogType [string](https://godoc.org/builtin#string)
|
||||||
|
|
||||||
|
time [string](https://godoc.org/builtin#string)
|
||||||
|
|
||||||
|
msg [string](https://godoc.org/builtin#string)
|
||||||
|
|
||||||
|
cid [string](https://godoc.org/builtin#string)
|
||||||
### <a name="MoreResponse"></a>type MoreResponse
|
### <a name="MoreResponse"></a>type MoreResponse
|
||||||
|
|
||||||
MoreResponse is a struct for when responses from varlink requires longer output
|
MoreResponse is a struct for when responses from varlink requires longer output
|
||||||
@ -1793,9 +1815,6 @@ PodNotFound means the pod could not be found by the provided name or ID in local
|
|||||||
### <a name="RuntimeError"></a>type RuntimeError
|
### <a name="RuntimeError"></a>type RuntimeError
|
||||||
|
|
||||||
RuntimeErrors generally means a runtime could not be found or gotten.
|
RuntimeErrors generally means a runtime could not be found or gotten.
|
||||||
### <a name="StreamEnded"></a>type StreamEnded
|
|
||||||
|
|
||||||
The Podman endpoint has closed because the stream ended.
|
|
||||||
### <a name="VolumeNotFound"></a>type VolumeNotFound
|
### <a name="VolumeNotFound"></a>type VolumeNotFound
|
||||||
|
|
||||||
VolumeNotFound means the volume could not be found by the name or ID in local storage.
|
VolumeNotFound means the volume could not be found by the name or ID in local storage.
|
||||||
|
@ -1151,7 +1151,7 @@ method GetPodsByContext(all: bool, latest: bool, args: []string) -> (pods: []str
|
|||||||
method LoadImage(name: string, inputFile: string, quiet: bool, deleteFile: bool) -> (reply: MoreResponse)
|
method LoadImage(name: string, inputFile: string, quiet: bool, deleteFile: bool) -> (reply: MoreResponse)
|
||||||
|
|
||||||
# GetEvents returns known libpod events filtered by the options provided.
|
# GetEvents returns known libpod events filtered by the options provided.
|
||||||
method GetEvents(filter: []string, since: string, stream: bool, until: string) -> (events: Event)
|
method GetEvents(filter: []string, since: string, until: string) -> (events: Event)
|
||||||
|
|
||||||
# ImageNotFound means the image could not be found by the provided name or ID in local storage.
|
# ImageNotFound means the image could not be found by the provided name or ID in local storage.
|
||||||
error ImageNotFound (id: string, reason: string)
|
error ImageNotFound (id: string, reason: string)
|
||||||
|
@ -219,6 +219,8 @@ func StringToStatus(name string) (Status, error) {
|
|||||||
return Create, nil
|
return Create, nil
|
||||||
case Exec.String():
|
case Exec.String():
|
||||||
return Exec, nil
|
return Exec, nil
|
||||||
|
case Exited.String():
|
||||||
|
return Exited, nil
|
||||||
case Export.String():
|
case Export.String():
|
||||||
return Export, nil
|
return Export, nil
|
||||||
case History.String():
|
case History.String():
|
||||||
|
@ -763,7 +763,11 @@ func (r *LocalRuntime) JoinOrCreateRootlessPod(pod *Pod) (bool, int, error) {
|
|||||||
|
|
||||||
// Events monitors libpod/podman events over a varlink connection
|
// Events monitors libpod/podman events over a varlink connection
|
||||||
func (r *LocalRuntime) Events(c *cliconfig.EventValues) error {
|
func (r *LocalRuntime) Events(c *cliconfig.EventValues) error {
|
||||||
reply, err := iopodman.GetEvents().Send(r.Conn, uint64(varlink.More), c.Filter, c.Since, c.Stream, c.Until)
|
var more uint64
|
||||||
|
if c.Stream {
|
||||||
|
more = uint64(varlink.More)
|
||||||
|
}
|
||||||
|
reply, err := iopodman.GetEvents().Send(r.Conn, more, c.Filter, c.Since, c.Until)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "unable to obtain events")
|
return errors.Wrapf(err, "unable to obtain events")
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// GetEvents is a remote endpoint to get events from the event log
|
// GetEvents is a remote endpoint to get events from the event log
|
||||||
func (i *LibpodAPI) GetEvents(call iopodman.VarlinkCall, filter []string, since string, stream bool, until string) error {
|
func (i *LibpodAPI) GetEvents(call iopodman.VarlinkCall, filter []string, since string, until string) error {
|
||||||
var (
|
var (
|
||||||
fromStart bool
|
fromStart bool
|
||||||
eventsError error
|
eventsError error
|
||||||
event *events.Event
|
event *events.Event
|
||||||
|
stream bool
|
||||||
)
|
)
|
||||||
if call.WantsMore() {
|
if call.WantsMore() {
|
||||||
|
stream = true
|
||||||
call.Continues = true
|
call.Continues = true
|
||||||
}
|
}
|
||||||
filters, err := shared.GenerateEventOptions(filter, since, until)
|
filters, err := shared.GenerateEventOptions(filter, since, until)
|
||||||
@ -52,5 +54,5 @@ func (i *LibpodAPI) GetEvents(call iopodman.VarlinkCall, filter []string, since
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return call.ReplyGetEvents(iopodman.Event{})
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user