mirror of
https://github.com/containers/podman.git
synced 2025-05-20 08:36:23 +08:00
Add event logging to libpod, even display to podman
In lipod, we now log major events that occurr. These events can be displayed using the `podman events` command. Each event contains: * Type (container, image, volume, pod...) * Status (create, rm, stop, kill, ....) * Timestamp in RFC3339Nano format * Name (if applicable) * Image (if applicable) The format of the event and the varlink endpoint are to not be considered stable until cockpit has done its enablement. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@ -8,6 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/libpod/libpod/events"
|
||||
"github.com/containers/storage/pkg/stringid"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/pkg/errors"
|
||||
@ -73,7 +74,7 @@ func (r *Runtime) newVolume(ctx context.Context, options ...VolumeCreateOption)
|
||||
if err := r.state.AddVolume(volume); err != nil {
|
||||
return nil, errors.Wrapf(err, "error adding volume to state")
|
||||
}
|
||||
|
||||
defer volume.newVolumeEvent(events.Create)
|
||||
return volume, nil
|
||||
}
|
||||
|
||||
@ -118,7 +119,7 @@ func (r *Runtime) removeVolume(ctx context.Context, v *Volume, force bool) error
|
||||
return errors.Wrapf(err, "error cleaning up volume storage for %q", v.Name())
|
||||
}
|
||||
|
||||
defer v.newVolumeEvent(events.Remove)
|
||||
logrus.Debugf("Removed volume %s", v.Name())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user