Skip to content

Commit bb0b184

Browse files
Merge pull request #16083 from dfr/freebsd-pod
Add support for 'podman pod' on FreeBSD
2 parents 5908996 + b4b7011 commit bb0b184

9 files changed

+413
-360
lines changed

libpod/pod_internal.go

+2-22
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@ package libpod
22

33
import (
44
"fmt"
5-
"path/filepath"
65
"time"
76

8-
"github.com/containers/common/pkg/config"
97
"github.com/containers/podman/v4/libpod/define"
10-
"github.com/containers/podman/v4/pkg/rootless"
118
"github.com/containers/storage/pkg/stringid"
12-
"github.com/sirupsen/logrus"
139
)
1410

1511
// Creates a new, empty pod
@@ -64,24 +60,8 @@ func (p *Pod) refresh() error {
6460
}
6561
p.lock = lock
6662

67-
// We need to recreate the pod's cgroup
68-
if p.config.UsePodCgroup {
69-
switch p.runtime.config.Engine.CgroupManager {
70-
case config.SystemdCgroupsManager:
71-
cgroupPath, err := systemdSliceFromPath(p.config.CgroupParent, fmt.Sprintf("libpod_pod_%s", p.ID()), p.ResourceLim())
72-
if err != nil {
73-
logrus.Errorf("Creating Cgroup for pod %s: %v", p.ID(), err)
74-
}
75-
p.state.CgroupPath = cgroupPath
76-
case config.CgroupfsCgroupsManager:
77-
if rootless.IsRootless() && isRootlessCgroupSet(p.config.CgroupParent) {
78-
p.state.CgroupPath = filepath.Join(p.config.CgroupParent, p.ID())
79-
80-
logrus.Debugf("setting pod cgroup to %s", p.state.CgroupPath)
81-
}
82-
default:
83-
return fmt.Errorf("unknown cgroups manager %s specified: %w", p.runtime.config.Engine.CgroupManager, define.ErrInvalidArg)
84-
}
63+
if err := p.platformRefresh(); err != nil {
64+
return err
8565
}
8666

8767
// Save changes

libpod/pod_internal_freebsd.go

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package libpod
2+
3+
func (p *Pod) platformRefresh() error {
4+
return nil
5+
}

libpod/pod_internal_linux.go

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package libpod
2+
3+
import (
4+
"fmt"
5+
"path/filepath"
6+
7+
"github.com/containers/common/pkg/config"
8+
"github.com/containers/podman/v4/libpod/define"
9+
"github.com/containers/podman/v4/pkg/rootless"
10+
"github.com/sirupsen/logrus"
11+
)
12+
13+
func (p *Pod) platformRefresh() error {
14+
// We need to recreate the pod's cgroup
15+
if p.config.UsePodCgroup {
16+
switch p.runtime.config.Engine.CgroupManager {
17+
case config.SystemdCgroupsManager:
18+
cgroupPath, err := systemdSliceFromPath(p.config.CgroupParent, fmt.Sprintf("libpod_pod_%s", p.ID()), p.ResourceLim())
19+
if err != nil {
20+
logrus.Errorf("Creating Cgroup for pod %s: %v", p.ID(), err)
21+
}
22+
p.state.CgroupPath = cgroupPath
23+
case config.CgroupfsCgroupsManager:
24+
if rootless.IsRootless() && isRootlessCgroupSet(p.config.CgroupParent) {
25+
p.state.CgroupPath = filepath.Join(p.config.CgroupParent, p.ID())
26+
27+
logrus.Debugf("setting pod cgroup to %s", p.state.CgroupPath)
28+
}
29+
default:
30+
return fmt.Errorf("unknown cgroups manager %s specified: %w", p.runtime.config.Engine.CgroupManager, define.ErrInvalidArg)
31+
}
32+
}
33+
return nil
34+
}

0 commit comments

Comments
 (0)