summaryrefslogtreecommitdiff
path: root/cmd/podman/varlink.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-08-04 10:12:27 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-05 10:43:32 +0000
commita1e3e542fff562d885354c55f04e0b7f5097a39b (patch)
tree7209d164b97252913bd8533a4326d53629e7566d /cmd/podman/varlink.go
parentdebf23c72ae1638a7efb294b6df9497224978d01 (diff)
downloadpodman-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/varlink.go')
-rw-r--r--cmd/podman/varlink.go10
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(