summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/images_build.go2
-rw-r--r--pkg/machine/qemu/machine.go2
-rw-r--r--pkg/machine/wsl/machine.go8
-rw-r--r--pkg/specgen/generate/validate.go9
-rw-r--r--pkg/util/utils.go2
5 files changed, 16 insertions, 7 deletions
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index 0a1bc941d..ba6764e91 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -170,7 +170,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
// convert addcaps formats
containerFiles := []string{}
- // Tells if query paramemter `dockerfile` is set or not.
+ // Tells if query parameter `dockerfile` is set or not.
dockerFileSet := false
if utils.IsLibpodRequest(r) && query.Remote != "" {
// The context directory could be a URL. Try to handle that.
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 6e36b0886..e3fb3b970 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -1545,7 +1545,7 @@ func (v *MachineVM) editCmdLine(flag string, value string) {
}
}
-// RemoveAndCleanMachines removes all machine and cleans up any other files associatied with podman machine
+// RemoveAndCleanMachines removes all machine and cleans up any other files associated with podman machine
func (p *Provider) RemoveAndCleanMachines() error {
var (
vm machine.VM
diff --git a/pkg/machine/wsl/machine.go b/pkg/machine/wsl/machine.go
index 0b2874baf..06020aded 100644
--- a/pkg/machine/wsl/machine.go
+++ b/pkg/machine/wsl/machine.go
@@ -831,16 +831,16 @@ func (v *MachineVM) Set(_ string, opts machine.SetOptions) ([]error, error) {
}
if opts.CPUs != nil {
- setErrors = append(setErrors, errors.Errorf("changing CPUs not suppored for WSL machines"))
+ setErrors = append(setErrors, errors.Errorf("changing CPUs not supported for WSL machines"))
}
if opts.Memory != nil {
- setErrors = append(setErrors, errors.Errorf("changing memory not suppored for WSL machines"))
+ setErrors = append(setErrors, errors.Errorf("changing memory not supported for WSL machines"))
}
if opts.DiskSize != nil {
- setErrors = append(setErrors, errors.Errorf("changing Disk Size not suppored for WSL machines"))
+ setErrors = append(setErrors, errors.Errorf("changing Disk Size not supported for WSL machines"))
}
return setErrors, v.writeConfig()
@@ -1477,7 +1477,7 @@ func (v *MachineVM) getResources() (resources machine.ResourceConfig) {
return
}
-// RemoveAndCleanMachines removes all machine and cleans up any other files associatied with podman machine
+// RemoveAndCleanMachines removes all machine and cleans up any other files associated with podman machine
func (p *Provider) RemoveAndCleanMachines() error {
var (
vm machine.VM
diff --git a/pkg/specgen/generate/validate.go b/pkg/specgen/generate/validate.go
index 44c7818e7..a1affef31 100644
--- a/pkg/specgen/generate/validate.go
+++ b/pkg/specgen/generate/validate.go
@@ -1,6 +1,7 @@
package generate
import (
+ "io/ioutil"
"os"
"path/filepath"
@@ -166,6 +167,14 @@ func verifyContainerResourcesCgroupV2(s *specgen.SpecGenerator) ([]string, error
if err != nil {
return warnings, err
}
+
+ if own == "/" {
+ // If running under the root cgroup try to create or reuse a "probe" cgroup to read memory values
+ own = "podman_probe"
+ _ = os.MkdirAll(filepath.Join("/sys/fs/cgroup", own), 0o755)
+ _ = ioutil.WriteFile("/sys/fs/cgroup/cgroup.subtree_control", []byte("+memory"), 0o644)
+ }
+
memoryMax := filepath.Join("/sys/fs/cgroup", own, "memory.max")
memorySwapMax := filepath.Join("/sys/fs/cgroup", own, "memory.swap.max")
_, errMemoryMax := os.Stat(memoryMax)
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index 1b7663330..ad5db9a1a 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -79,7 +79,7 @@ func ParseRegistryCreds(creds string) (*types.DockerAuthConfig, error) {
}, nil
}
-// StringInSlice is depracated, use containers/common/pkg/util/StringInSlice
+// StringInSlice is deprecated, use containers/common/pkg/util/StringInSlice
func StringInSlice(s string, sl []string) bool {
return util.StringInSlice(s, sl)
}