From a1e3e542fff562d885354c55f04e0b7f5097a39b Mon Sep 17 00:00:00 2001 From: baude Date: Sat, 4 Aug 2018 10:12:27 -0500 Subject: 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 Closes: #1215 Approved by: rhatdan --- cmd/podman/varlink.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd/podman/varlink.go') 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( -- cgit v1.2.3-54-g00ecf