-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't fail if one of the cgroups is not setup
It is fairly common for certain cgroups controllers to not be enabled on a system. We should Warn when this happens versus failing, when doing podman stats command. This way users can get information from the other controllers. Fixes: #8588 Signed-off-by: Daniel J Walsh <[email protected]>
- Loading branch information
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cgroups | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/containers/podman/v2/pkg/rootless" | ||
spec "github.com/opencontainers/runtime-spec/specs-go" | ||
) | ||
|
||
func TestCreated(t *testing.T) { | ||
// tests only works in rootless mode | ||
if rootless.IsRootless() { | ||
return | ||
} | ||
|
||
var resources spec.LinuxResources | ||
cgr, err := New("machine.slice", &resources) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
if err := cgr.Delete(); err != nil { | ||
t.Error(err) | ||
} | ||
|
||
cgr, err = NewSystemd("machine.slice") | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
if err := cgr.Delete(); err != nil { | ||
t.Error(err) | ||
} | ||
} |