diff options
author | Matthew Heon <mheon@redhat.com> | 2019-04-25 16:23:09 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2019-04-25 16:23:09 -0400 |
commit | 04d6ff058270006b98961e0f973ff6ee4c3ba8e8 (patch) | |
tree | a929615470ee8c220f95512f194054d145656be7 /libpod/runtime.go | |
parent | a01c62fcbde1afdc77aa05b71c3c84ddacf7fc55 (diff) | |
download | podman-04d6ff058270006b98961e0f973ff6ee4c3ba8e8.tar.gz podman-04d6ff058270006b98961e0f973ff6ee4c3ba8e8.tar.bz2 podman-04d6ff058270006b98961e0f973ff6ee4c3ba8e8.zip |
Add System event type and renumber, refresh events
Also, re-add locking to file eventer Write() to protect against
concurrent events.
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index d03731284..69cc10389 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -2,7 +2,6 @@ package libpod import ( "fmt" - "github.com/containers/libpod/libpod/events" "io/ioutil" "os" "path/filepath" @@ -12,6 +11,7 @@ import ( "github.com/BurntSushi/toml" is "github.com/containers/image/storage" "github.com/containers/image/types" + "github.com/containers/libpod/libpod/events" "github.com/containers/libpod/libpod/image" "github.com/containers/libpod/libpod/lock" "github.com/containers/libpod/pkg/firewall" @@ -754,6 +754,17 @@ func makeRuntime(runtime *Runtime) (err error) { if err != nil { return err } + + defer func() { + if err != nil && store != nil { + // Don't forcibly shut down + // We could be opening a store in use by another libpod + _, err2 := store.Shutdown(false) + if err2 != nil { + logrus.Errorf("Error removing store for partially-created runtime: %s", err2) + } + } + }() } runtime.store = store @@ -780,17 +791,6 @@ func makeRuntime(runtime *Runtime) (err error) { runtime.eventer = eventer ir.Eventer = eventer - defer func() { - if err != nil && store != nil { - // Don't forcibly shut down - // We could be opening a store in use by another libpod - _, err2 := store.Shutdown(false) - if err2 != nil { - logrus.Errorf("Error removing store for partially-created runtime: %s", err2) - } - } - }() - // Set up a storage service for creating container root filesystems from // images storageService, err := getStorageService(runtime.store) @@ -1074,6 +1074,8 @@ func (r *Runtime) refresh(alivePath string) error { } defer file.Close() + r.newSystemEvent(events.Refresh) + return nil } |