mirror of
https://github.com/containers/podman.git
synced 2025-06-20 09:03:43 +08:00
Merge pull request #5919 from rhatdan/v2
Lots more fixes for V2 conversion.
This commit is contained in:
@ -55,7 +55,7 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet {
|
|||||||
"cgroup namespace to use",
|
"cgroup namespace to use",
|
||||||
)
|
)
|
||||||
createFlags.StringVar(
|
createFlags.StringVar(
|
||||||
&cf.CGroups,
|
&cf.CGroupsMode,
|
||||||
"cgroups", containerConfig.Cgroups(),
|
"cgroups", containerConfig.Cgroups(),
|
||||||
`control container cgroup configuration ("enabled"|"disabled"|"no-conmon")`,
|
`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 `_`",
|
"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(
|
createFlags.StringSliceVar(
|
||||||
&cf.Device,
|
&cf.Devices,
|
||||||
"device", containerConfig.Devices(),
|
"device", containerConfig.Devices(),
|
||||||
fmt.Sprintf("Add a host device to the container"),
|
fmt.Sprintf("Add a host device to the container"),
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@ type ContainerCLIOpts struct {
|
|||||||
CapAdd []string
|
CapAdd []string
|
||||||
CapDrop []string
|
CapDrop []string
|
||||||
CGroupsNS string
|
CGroupsNS string
|
||||||
CGroups string
|
CGroupsMode string
|
||||||
CGroupParent string
|
CGroupParent string
|
||||||
CIDFile string
|
CIDFile string
|
||||||
ConmonPIDFile string
|
ConmonPIDFile string
|
||||||
@ -25,7 +25,7 @@ type ContainerCLIOpts struct {
|
|||||||
CPUSetMems string
|
CPUSetMems string
|
||||||
Detach bool
|
Detach bool
|
||||||
DetachKeys string
|
DetachKeys string
|
||||||
Device []string
|
Devices []string
|
||||||
DeviceCGroupRule []string
|
DeviceCGroupRule []string
|
||||||
DeviceReadBPs []string
|
DeviceReadBPs []string
|
||||||
DeviceReadIOPs []string
|
DeviceReadIOPs []string
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/containers/libpod/cmd/podman/parse"
|
"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/domain/entities"
|
||||||
"github.com/containers/libpod/pkg/specgen"
|
"github.com/containers/libpod/pkg/specgen"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -149,6 +150,9 @@ func NetFlagsToNetOptions(cmd *cobra.Command) (*entities.NetOptions, error) {
|
|||||||
if staticIP == nil {
|
if staticIP == nil {
|
||||||
return nil, errors.Errorf("%s is not an ip address", ip)
|
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
|
opts.StaticIP = &staticIP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ func getPidsLimits(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string)
|
|||||||
pids.Limit = c.PIDsLimit
|
pids.Limit = c.PIDsLimit
|
||||||
hasLimits = true
|
hasLimits = true
|
||||||
}
|
}
|
||||||
if c.CGroups == "disabled" && c.PIDsLimit > 0 {
|
if c.CGroupsMode == "disabled" && c.PIDsLimit > 0 {
|
||||||
s.ResourceLimits.Pids.Limit = -1
|
s.ResourceLimits.Pids.Limit = -1
|
||||||
}
|
}
|
||||||
if !hasLimits {
|
if !hasLimits {
|
||||||
@ -472,12 +472,11 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
|
|||||||
if ld := c.LogDriver; len(ld) > 0 {
|
if ld := c.LogDriver; len(ld) > 0 {
|
||||||
s.LogConfiguration.Driver = ld
|
s.LogConfiguration.Driver = ld
|
||||||
}
|
}
|
||||||
|
s.CgroupParent = c.CGroupParent
|
||||||
|
s.CgroupsMode = c.CGroupsMode
|
||||||
// TODO WTF
|
// TODO WTF
|
||||||
//cgroup := &cc.CgroupConfig{
|
//cgroup := &cc.CgroupConfig{
|
||||||
// Cgroups: c.String("cgroups"),
|
|
||||||
// Cgroupns: c.String("cgroupns"),
|
// Cgroupns: c.String("cgroupns"),
|
||||||
// CgroupParent: c.String("cgroup-parent"),
|
|
||||||
// CgroupMode: cgroupMode,
|
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//userns := &cc.UserConfig{
|
//userns := &cc.UserConfig{
|
||||||
@ -494,6 +493,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
|
|||||||
// Hostname: c.String("hostname"),
|
// Hostname: c.String("hostname"),
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
s.Hostname = c.Hostname
|
||||||
sysctl := map[string]string{}
|
sysctl := map[string]string{}
|
||||||
if ctl := c.Sysctl; len(ctl) > 0 {
|
if ctl := c.Sysctl; len(ctl) > 0 {
|
||||||
sysctl, err = util.ValidateSysctls(ctl)
|
sysctl, err = util.ValidateSysctls(ctl)
|
||||||
@ -561,14 +561,9 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
|
|||||||
//s.Mounts = c.Mount
|
//s.Mounts = c.Mount
|
||||||
s.VolumesFrom = c.VolumesFrom
|
s.VolumesFrom = c.VolumesFrom
|
||||||
|
|
||||||
// TODO any idea why this was done
|
for _, dev := range c.Devices {
|
||||||
//devices := rtc.Containers.Devices
|
s.Devices = append(s.Devices, specs.LinuxDevice{Path: dev})
|
||||||
// TODO conflict on populate?
|
}
|
||||||
//
|
|
||||||
//if c.Changed("device") {
|
|
||||||
// devices = append(devices, c.StringSlice("device")...)
|
|
||||||
//}
|
|
||||||
|
|
||||||
// TODO things i cannot find in spec
|
// TODO things i cannot find in spec
|
||||||
// we dont think these are in the spec
|
// we dont think these are in the spec
|
||||||
// init - initbinary
|
// init - initbinary
|
||||||
|
Reference in New Issue
Block a user