Merge pull request #5919 from rhatdan/v2

Lots more fixes for V2 conversion.
This commit is contained in:
OpenShift Merge Robot
2020-04-21 16:53:53 -04:00
committed by GitHub
4 changed files with 15 additions and 16 deletions

View File

@ -55,7 +55,7 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet {
"cgroup namespace to use",
)
createFlags.StringVar(
&cf.CGroups,
&cf.CGroupsMode,
"cgroups", containerConfig.Cgroups(),
`control container cgroup configuration ("enabled"|"disabled"|"no-conmon")`,
)
@ -125,7 +125,7 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet {
"Override the key sequence for detaching a container. Format is a single character `[a-Z]` or a comma separated sequence of `ctrl-<value>`, where `<value>` is one of: `a-cf`, `@`, `^`, `[`, `\\`, `]`, `^` or `_`",
)
createFlags.StringSliceVar(
&cf.Device,
&cf.Devices,
"device", containerConfig.Devices(),
fmt.Sprintf("Add a host device to the container"),
)

View File

@ -11,7 +11,7 @@ type ContainerCLIOpts struct {
CapAdd []string
CapDrop []string
CGroupsNS string
CGroups string
CGroupsMode string
CGroupParent string
CIDFile string
ConmonPIDFile string
@ -25,7 +25,7 @@ type ContainerCLIOpts struct {
CPUSetMems string
Detach bool
DetachKeys string
Device []string
Devices []string
DeviceCGroupRule []string
DeviceReadBPs []string
DeviceReadIOPs []string

View File

@ -4,6 +4,7 @@ import (
"net"
"github.com/containers/libpod/cmd/podman/parse"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/containers/libpod/pkg/specgen"
"github.com/pkg/errors"
@ -149,6 +150,9 @@ func NetFlagsToNetOptions(cmd *cobra.Command) (*entities.NetOptions, error) {
if staticIP == nil {
return nil, errors.Errorf("%s is not an ip address", ip)
}
if staticIP.To4() == nil {
return nil, errors.Wrapf(define.ErrInvalidArg, "%s is not an IPv4 address", ip)
}
opts.StaticIP = &staticIP
}

View File

@ -123,7 +123,7 @@ func getPidsLimits(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string)
pids.Limit = c.PIDsLimit
hasLimits = true
}
if c.CGroups == "disabled" && c.PIDsLimit > 0 {
if c.CGroupsMode == "disabled" && c.PIDsLimit > 0 {
s.ResourceLimits.Pids.Limit = -1
}
if !hasLimits {
@ -472,12 +472,11 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
if ld := c.LogDriver; len(ld) > 0 {
s.LogConfiguration.Driver = ld
}
s.CgroupParent = c.CGroupParent
s.CgroupsMode = c.CGroupsMode
// TODO WTF
//cgroup := &cc.CgroupConfig{
// Cgroups: c.String("cgroups"),
// Cgroupns: c.String("cgroupns"),
// CgroupParent: c.String("cgroup-parent"),
// CgroupMode: cgroupMode,
//}
//
//userns := &cc.UserConfig{
@ -494,6 +493,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
// Hostname: c.String("hostname"),
//}
s.Hostname = c.Hostname
sysctl := map[string]string{}
if ctl := c.Sysctl; len(ctl) > 0 {
sysctl, err = util.ValidateSysctls(ctl)
@ -561,14 +561,9 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
//s.Mounts = c.Mount
s.VolumesFrom = c.VolumesFrom
// TODO any idea why this was done
//devices := rtc.Containers.Devices
// TODO conflict on populate?
//
//if c.Changed("device") {
// devices = append(devices, c.StringSlice("device")...)
//}
for _, dev := range c.Devices {
s.Devices = append(s.Devices, specs.LinuxDevice{Path: dev})
}
// TODO things i cannot find in spec
// we dont think these are in the spec
// init - initbinary