Merge pull request #2521 from zvier/master

cleancode: clean code for utils_linux.go
This commit is contained in:
Kir Kolyshkin 2020-07-23 12:58:24 -07:00 committed by GitHub
commit d65df61dc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 10 deletions

View File

@ -47,14 +47,13 @@ func loadFactory(context *cli.Context) (libcontainer.Factory, error) {
cgroupManager = libcontainer.RootlessCgroupfs cgroupManager = libcontainer.RootlessCgroupfs
} }
if context.GlobalBool("systemd-cgroup") { if context.GlobalBool("systemd-cgroup") {
if systemd.IsRunningSystemd() { if !systemd.IsRunningSystemd() {
cgroupManager = libcontainer.SystemdCgroups
if rootlessCg {
cgroupManager = libcontainer.RootlessSystemdCgroups
}
} else {
return nil, errors.New("systemd cgroup flag passed, but systemd support for managing cgroups is not available") return nil, errors.New("systemd cgroup flag passed, but systemd support for managing cgroups is not available")
} }
cgroupManager = libcontainer.SystemdCgroups
if rootlessCg {
cgroupManager = libcontainer.RootlessSystemdCgroups
}
} }
intelRdtManager := libcontainer.IntelRdtFs intelRdtManager := libcontainer.IntelRdtFs
@ -423,13 +422,11 @@ func startContainer(context *cli.Context, spec *specs.Spec, action CtAct, criuOp
} }
if notifySocket != nil { if notifySocket != nil {
err := notifySocket.setupSocketDirectory() if err := notifySocket.setupSocketDirectory(); err != nil {
if err != nil {
return -1, err return -1, err
} }
if action == CT_ACT_RUN { if action == CT_ACT_RUN {
err := notifySocket.bindSocket() if err := notifySocket.bindSocket(); err != nil {
if err != nil {
return -1, err return -1, err
} }
} }