diff options
author | baude <bbaude@redhat.com> | 2018-08-04 10:12:27 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-05 10:43:32 +0000 |
commit | a1e3e542fff562d885354c55f04e0b7f5097a39b (patch) | |
tree | 7209d164b97252913bd8533a4326d53629e7566d /cmd/podman | |
parent | debf23c72ae1638a7efb294b6df9497224978d01 (diff) | |
download | podman-a1e3e542fff562d885354c55f04e0b7f5097a39b.tar.gz podman-a1e3e542fff562d885354c55f04e0b7f5097a39b.tar.bz2 podman-a1e3e542fff562d885354c55f04e0b7f5097a39b.zip |
Make one runtime for the varlink service
Rather than making a runtime each time a client hits a varlink endpoint, we now
make a single runtime when the varlink service starts up. This fixes a problem
where we hit a max inotify limit from CNI.
Resolves: #1211
Signed-off-by: baude <bbaude@redhat.com>
Closes: #1215
Approved by: rhatdan
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/varlink.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go index f1bf2db6b..ae36ba1e7 100644 --- a/cmd/podman/varlink.go +++ b/cmd/podman/varlink.go @@ -6,6 +6,7 @@ import ( "time" "github.com/pkg/errors" + "github.com/projectatomic/libpod/cmd/podman/libpodruntime" ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink" "github.com/projectatomic/libpod/pkg/varlinkapi" "github.com/projectatomic/libpod/version" @@ -44,7 +45,14 @@ func varlinkCmd(c *cli.Context) error { } timeout := time.Duration(c.Int64("timeout")) * time.Millisecond - var varlinkInterfaces = []*ioprojectatomicpodman.VarlinkInterface{varlinkapi.New(c)} + // Create a single runtime for varlink + runtime, err := libpodruntime.GetRuntime(c) + if err != nil { + return errors.Wrapf(err, "error creating libpod runtime") + } + defer runtime.Shutdown(false) + + var varlinkInterfaces = []*ioprojectatomicpodman.VarlinkInterface{varlinkapi.New(c, runtime)} // Register varlink service. The metadata can be retrieved with: // $ varlink info [varlink address URI] service, err := varlink.NewService( |