Skip to content

Commit af91cae

Browse files
Merge pull request #27271 from lsm5/podman6-no-cgv1
Podman6: Remove cgroupsv1
2 parents 78b3f86 + 145540f commit af91cae

File tree

73 files changed

+163
-908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+163
-908
lines changed

.packit.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ srpm_build_deps:
4444
- make
4545

4646
actions:
47-
fix-spec-file: "bash .packit-copr-rpm.sh"
48-
pre-sync: "bash .packit-rpm-git-commit.sh"
47+
fix-spec-file: "bash contrib/packit-tmt/packit-copr-rpm.sh"
48+
pre-sync: "bash contrib/packit-tmt/packit-rpm-git-commit.sh"
4949

5050
jobs:
5151
- job: copr_build

cmd/podman/containers/unpause.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package containers
22

33
import (
44
"context"
5-
"errors"
65
"fmt"
76
"os"
87
"strings"
@@ -12,9 +11,7 @@ import (
1211
"github.com/containers/podman/v6/cmd/podman/utils"
1312
"github.com/containers/podman/v6/cmd/podman/validate"
1413
"github.com/containers/podman/v6/pkg/domain/entities"
15-
"github.com/containers/podman/v6/pkg/rootless"
1614
"github.com/spf13/cobra"
17-
"go.podman.io/common/pkg/cgroups"
1815
"go.podman.io/common/pkg/completion"
1916
)
2017

@@ -91,13 +88,6 @@ func unpause(_ *cobra.Command, args []string) error {
9188
var errs utils.OutputErrors
9289
args = utils.RemoveSlash(args)
9390

94-
if rootless.IsRootless() && !registry.IsRemote() {
95-
cgroupv2, _ := cgroups.IsCgroup2UnifiedMode()
96-
if !cgroupv2 {
97-
return errors.New("unpause is not supported for cgroupv1 rootless containers")
98-
}
99-
}
100-
10191
for _, cidFile := range unpauseCidFiles {
10292
content, err := os.ReadFile(cidFile)
10393
if err != nil {

cmd/podman/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ func setupRemoteConnection(podmanConfig *entities.PodmanConfig) string {
248248
func persistentPreRunE(cmd *cobra.Command, args []string) error {
249249
logrus.Debugf("Called %s.PersistentPreRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))
250250

251+
checkSupportedCgroups()
252+
251253
// Help, completion and commands with subcommands are special cases, no need for more setup
252254
// Completion cmd is used to generate the shell scripts
253255
if cmd.Name() == "help" || cmd.Name() == "completion" || cmd.HasSubCommands() {

cmd/podman/root_cgroups_linux.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//go:build linux
2+
3+
package main
4+
5+
import (
6+
"github.com/sirupsen/logrus"
7+
"go.podman.io/common/pkg/cgroups"
8+
)
9+
10+
func checkSupportedCgroups() {
11+
unified, err := cgroups.IsCgroup2UnifiedMode()
12+
if err != nil {
13+
logrus.Fatalf("Error determining cgroups mode")
14+
}
15+
if !unified {
16+
logrus.Fatalf("Cgroups v1 not supported")
17+
}
18+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//go:build !linux
2+
3+
package main
4+
5+
func checkSupportedCgroups() {
6+
// NOP on Non Linux
7+
}

cmd/podman/system/service_abi_linux.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package system
44

55
import (
6-
"github.com/containers/podman/v6/pkg/rootless"
76
"github.com/sirupsen/logrus"
87
"go.podman.io/common/pkg/cgroups"
98
"go.podman.io/common/pkg/servicereaper"
@@ -15,11 +14,6 @@ func maybeStartServiceReaper() {
1514
}
1615

1716
func maybeMoveToSubCgroup() {
18-
cgroupv2, _ := cgroups.IsCgroup2UnifiedMode()
19-
if rootless.IsRootless() && !cgroupv2 {
20-
logrus.Warnf("Running 'system service' in rootless mode without cgroup v2, containers won't survive a 'system service' restart")
21-
}
22-
2317
if err := cgroups.MaybeMoveToSubCgroup(); err != nil {
2418
// it is a best effort operation, so just print the
2519
// error for debugging purposes.

.packit-copr-rpm.sh renamed to contrib/packit-tmt/packit-copr-rpm.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66

77
set -exo pipefail
88

9-
. .packit-rpm-git-commit.sh
9+
TOP_GIT_DIR=$(git rev-parse --show-toplevel)
10+
11+
. "$TOP_GIT_DIR"/contrib/packit-tmt/packit-rpm-git-commit.sh
1012

1113
# Get Version from HEAD
1214
VERSION=$(grep '^const RawVersion' version/rawversion/version.go | cut -d\" -f2)
1315

1416
# RPM Version can't take "-"
15-
RPM_VERSION=$(echo $VERSION | sed -e 's/-/~/')
17+
# shellcheck disable=SC2001
18+
RPM_VERSION=$(echo "$VERSION" | sed -e 's/-/~/')
1619

1720
# Generate source tarball from HEAD
18-
git-archive-all -C $(git rev-parse --show-toplevel) --prefix=$PACKAGE-$VERSION/ rpm/$PACKAGE-$VERSION.tar.gz
21+
git-archive-all -C "$TOP_GIT_DIR" --prefix="$PACKAGE-$VERSION/" "$TOP_GIT_DIR/rpm/$PACKAGE-$VERSION.tar.gz"
1922

2023
# RPM Spec modifications
2124

File renamed without changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
set -exo pipefail
4+
5+
COPR_REPO_FILE="/etc/yum.repos.d/_copr:copr.fedorainfracloud.org:rhcontainerbot:podman-next.repo"
6+
if compgen -G "$COPR_REPO_FILE" > /dev/null; then
7+
# We want the priority bump appended to the file, we're not looking
8+
# to use a variable.
9+
# shellcheck disable=SC2016
10+
sed -i -n '/^priority=/!p;$apriority=1' "$COPR_REPO_FILE"
11+
fi
12+
# We want all dependencies from podman-next except podman as podman will be fetched
13+
# from the packit copr.
14+
dnf -y upgrade --allowerasing --exclude=podman*

docs/source/locale/ja/LC_MESSAGES/markdown.po

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26352,16 +26352,9 @@ msgstr ""
2635226352
msgid "Display a live stream of one or more containers' resource usage statistics"
2635326353
msgstr ""
2635426354

26355-
#: ../../source/markdown/podman-stats.1.md:15
26356-
msgid ""
26357-
"Note: Podman stats does not work in rootless environments that use "
26358-
"CGroups V1. Podman stats relies on CGroup information for statistics, and"
26359-
" CGroup v1 is not supported for rootless use cases."
26360-
msgstr ""
26361-
2636226355
#: ../../source/markdown/podman-stats.1.md:19
2636326356
msgid ""
26364-
"Note: Rootless environments that use CGroups V2 are not able to report "
26357+
"Note: Rootless environments are not able to report "
2636526358
"statistics about their networking usage."
2636626359
msgstr ""
2636726360

@@ -26481,10 +26474,6 @@ msgstr ""
2648126474
msgid "Network Output"
2648226475
msgstr ""
2648326476

26484-
#: ../../source/markdown/podman-stats.1.md:1
26485-
msgid ".PerCPU"
26486-
msgstr ""
26487-
2648826477
#: ../../source/markdown/podman-stats.1.md:1
2648926478
msgid "CPU time consumed by all tasks [1]"
2649026479
msgstr ""
@@ -26521,10 +26510,6 @@ msgstr ""
2652126510
msgid "Same as UpTime"
2652226511
msgstr ""
2652326512

26524-
#: ../../source/markdown/podman-stats.1.md:64
26525-
msgid "[1] Cgroups V1 only"
26526-
msgstr ""
26527-
2652826513
#: ../../source/markdown/podman-stats.1.md:68
2652926514
msgid "**--interval**, **-i**=*seconds*"
2653026515
msgstr ""

0 commit comments

Comments
 (0)