summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/containers_create.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 /pkg/varlinkapi/containers_create.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 'pkg/varlinkapi/containers_create.go')
-rw-r--r--pkg/varlinkapi/containers_create.go17
1 files changed, 5 insertions, 12 deletions
diff --git a/pkg/varlinkapi/containers_create.go b/pkg/varlinkapi/containers_create.go
index da6707248..6a601dae8 100644
--- a/pkg/varlinkapi/containers_create.go
+++ b/pkg/varlinkapi/containers_create.go
@@ -10,7 +10,6 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/pkg/signal"
- "github.com/projectatomic/libpod/cmd/podman/libpodruntime"
"github.com/projectatomic/libpod/cmd/podman/varlink"
"github.com/projectatomic/libpod/libpod"
"github.com/projectatomic/libpod/libpod/image"
@@ -22,22 +21,16 @@ import (
// CreateContainer ...
func (i *LibpodAPI) CreateContainer(call ioprojectatomicpodman.VarlinkCall, config ioprojectatomicpodman.Create) error {
- runtime, err := libpodruntime.GetRuntime(i.Cli)
- if err != nil {
- return call.ReplyRuntimeError(err.Error())
- }
- defer runtime.Shutdown(false)
-
- rtc := runtime.GetConfig()
+ rtc := i.Runtime.GetConfig()
ctx := getContext()
- newImage, err := runtime.ImageRuntime().New(ctx, config.Image, rtc.SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{}, false, false)
+ newImage, err := i.Runtime.ImageRuntime().New(ctx, config.Image, rtc.SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{}, false, false)
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
data, err := newImage.Inspect(ctx)
- createConfig, err := varlinkCreateToCreateConfig(ctx, config, runtime, config.Image, data)
+ createConfig, err := varlinkCreateToCreateConfig(ctx, config, i.Runtime, config.Image, data)
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
@@ -47,12 +40,12 @@ func (i *LibpodAPI) CreateContainer(call ioprojectatomicpodman.VarlinkCall, conf
return call.ReplyErrorOccurred(err.Error())
}
- options, err := createConfig.GetContainerCreateOptions(runtime)
+ options, err := createConfig.GetContainerCreateOptions(i.Runtime)
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
- ctr, err := runtime.NewContainer(ctx, runtimeSpec, options...)
+ ctr, err := i.Runtime.NewContainer(ctx, runtimeSpec, options...)
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}