summaryrefslogtreecommitdiff
path: root/vendor/github.com/containerd/cgroups/systemd.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-02-02 19:43:19 +0000
committerGitHub <noreply@github.com>2018-02-02 19:43:19 +0000
commit3ea23f84818a816104ccdcf6b836ac4bb3a7c366 (patch)
tree7ccc25d859c97ca2cad5282d7e0f4eb9a445c2e3 /vendor/github.com/containerd/cgroups/systemd.go
parenta01f708df5d378af6ff4e804464b34f7c9be2b5d (diff)
parenta417e6e0cc46593eb10d2ce3d5102df39d44b8dd (diff)
downloadpodman-3ea23f84818a816104ccdcf6b836ac4bb3a7c366.tar.gz
podman-3ea23f84818a816104ccdcf6b836ac4bb3a7c366.tar.bz2
podman-3ea23f84818a816104ccdcf6b836ac4bb3a7c366.zip
Merge pull request #284 from mheon/update_vendors
Update containerd/cgroups to fix perf issue
Diffstat (limited to 'vendor/github.com/containerd/cgroups/systemd.go')
-rw-r--r--vendor/github.com/containerd/cgroups/systemd.go34
1 files changed, 24 insertions, 10 deletions
diff --git a/vendor/github.com/containerd/cgroups/systemd.go b/vendor/github.com/containerd/cgroups/systemd.go
index 5e052a821..fd816e32e 100644
--- a/vendor/github.com/containerd/cgroups/systemd.go
+++ b/vendor/github.com/containerd/cgroups/systemd.go
@@ -43,19 +43,13 @@ func Slice(slice, name string) Path {
}
func NewSystemd(root string) (*SystemdController, error) {
- conn, err := systemdDbus.New()
- if err != nil {
- return nil, err
- }
return &SystemdController{
root: root,
- conn: conn,
}, nil
}
type SystemdController struct {
mu sync.Mutex
- conn *systemdDbus.Conn
root string
}
@@ -64,6 +58,11 @@ func (s *SystemdController) Name() Name {
}
func (s *SystemdController) Create(path string, resources *specs.LinuxResources) error {
+ conn, err := systemdDbus.New()
+ if err != nil {
+ return err
+ }
+ defer conn.Close()
slice, name := splitName(path)
properties := []systemdDbus.Property{
systemdDbus.PropDescription(fmt.Sprintf("cgroup %s", name)),
@@ -74,14 +73,29 @@ func (s *SystemdController) Create(path string, resources *specs.LinuxResources)
newProperty("CPUAccounting", true),
newProperty("BlockIOAccounting", true),
}
- _, err := s.conn.StartTransientUnit(name, "replace", properties, nil)
- return err
+ ch := make(chan string)
+ _, err = conn.StartTransientUnit(name, "replace", properties, ch)
+ if err != nil {
+ return err
+ }
+ <-ch
+ return nil
}
func (s *SystemdController) Delete(path string) error {
+ conn, err := systemdDbus.New()
+ if err != nil {
+ return err
+ }
+ defer conn.Close()
_, name := splitName(path)
- _, err := s.conn.StopUnit(name, "replace", nil)
- return err
+ ch := make(chan string)
+ _, err = conn.StopUnit(name, "replace", ch)
+ if err != nil {
+ return err
+ }
+ <-ch
+ return nil
}
func newProperty(name string, units interface{}) systemdDbus.Property {