summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/boltdb_state_unsupported.go13
-rw-r--r--libpod/container_copy_unsupported.go16
-rw-r--r--libpod/container_internal_linux.go65
-rw-r--r--libpod/container_internal_unsupported.go64
-rw-r--r--libpod/container_stat_unsupported.go13
-rw-r--r--libpod/container_top_unsupported.go23
-rw-r--r--libpod/container_unsupported.go5
-rw-r--r--libpod/events/events.go13
-rw-r--r--libpod/events/journal_linux.go2
-rw-r--r--libpod/healthcheck_unsupported.go21
-rw-r--r--libpod/network/cni/cni_conversion.go41
-rw-r--r--libpod/network/cni/cni_types.go20
-rw-r--r--libpod/network/cni/config.go6
-rw-r--r--libpod/network/cni/config_test.go102
-rw-r--r--libpod/network/cni/network.go2
-rw-r--r--libpod/network/types/const.go2
-rw-r--r--libpod/networking_unsupported.go40
-rw-r--r--libpod/oci_attach_unsupported.go17
-rw-r--r--libpod/oci_conmon_unsupported.go132
-rw-r--r--libpod/pod_top_unsupported.go10
-rw-r--r--libpod/runtime.go2
-rw-r--r--libpod/runtime_migrate_unsupported.go15
-rw-r--r--libpod/runtime_pod_unsupported.go18
-rw-r--r--libpod/runtime_volume_unsupported.go21
-rw-r--r--libpod/stats_unsupported.go10
-rw-r--r--libpod/util_unsupported.go34
-rw-r--r--libpod/volume_internal_unsupported.go15
27 files changed, 199 insertions, 523 deletions
diff --git a/libpod/boltdb_state_unsupported.go b/libpod/boltdb_state_unsupported.go
deleted file mode 100644
index 244dc51a0..000000000
--- a/libpod/boltdb_state_unsupported.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build !linux
-
-package libpod
-
-// replaceNetNS is exclusive to the Linux platform and is a no-op elsewhere
-func replaceNetNS(netNSPath string, ctr *Container, newState *ContainerState) error {
- return nil
-}
-
-// getNetNSPath is exclusive to the Linux platform and is a no-op elsewhere
-func getNetNSPath(ctr *Container) string {
- return ""
-}
diff --git a/libpod/container_copy_unsupported.go b/libpod/container_copy_unsupported.go
deleted file mode 100644
index b2bdd3e3d..000000000
--- a/libpod/container_copy_unsupported.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
- "io"
-)
-
-func (c *Container) copyFromArchive(ctx context.Context, path string, reader io.Reader) (func() error, error) {
- return nil, nil
-}
-
-func (c *Container) copyToArchive(ctx context.Context, path string, writer io.Writer) (func() error, error) {
- return nil, nil
-}
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 0557b30d0..dbecea031 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -2033,15 +2033,16 @@ func (c *Container) getHosts() string {
// Do we have a network namespace?
netNone := false
- for _, ns := range c.config.Spec.Linux.Namespaces {
- if ns.Type == spec.NetworkNamespace {
- if ns.Path == "" && !c.config.CreateNetNS {
- netNone = true
+ if c.config.NetNsCtr == "" && !c.config.CreateNetNS {
+ for _, ns := range c.config.Spec.Linux.Namespaces {
+ if ns.Type == spec.NetworkNamespace {
+ if ns.Path == "" {
+ netNone = true
+ }
+ break
}
- break
}
}
-
// If we are net=none (have a network namespace, but not connected to
// anything) add the container's name and hostname to localhost.
if netNone {
@@ -2049,35 +2050,39 @@ func (c *Container) getHosts() string {
}
}
- // Add gateway entry
- var depCtr *Container
- netStatus := c.getNetworkStatus()
- if c.config.NetNsCtr != "" {
- // ignoring the error because there isn't anything to do
- depCtr, _ = c.getRootNetNsDepCtr()
- } else if len(netStatus) != 0 {
- depCtr = c
- }
-
- if depCtr != nil {
- for _, status := range depCtr.getNetworkStatus() {
- for _, netInt := range status.Interfaces {
- for _, netAddress := range netInt.Networks {
- if netAddress.Gateway != nil {
- hosts += fmt.Sprintf("%s host.containers.internal\n", netAddress.Gateway.String())
+ // Add gateway entry if we are not in a machine. If we use podman machine
+ // the gvproxy dns server will take care of host.containers.internal.
+ // https://github.com/containers/gvisor-tap-vsock/commit/1108ea45162281046d239047a6db9bc187e64b08
+ if !c.runtime.config.Engine.MachineEnabled {
+ var depCtr *Container
+ netStatus := c.getNetworkStatus()
+ if c.config.NetNsCtr != "" {
+ // ignoring the error because there isn't anything to do
+ depCtr, _ = c.getRootNetNsDepCtr()
+ } else if len(netStatus) != 0 {
+ depCtr = c
+ }
+
+ if depCtr != nil {
+ for _, status := range depCtr.getNetworkStatus() {
+ for _, netInt := range status.Interfaces {
+ for _, netAddress := range netInt.Networks {
+ if netAddress.Gateway != nil {
+ hosts += fmt.Sprintf("%s host.containers.internal\n", netAddress.Gateway.String())
+ }
}
}
}
- }
- } else if c.config.NetMode.IsSlirp4netns() {
- gatewayIP, err := GetSlirp4netnsGateway(c.slirp4netnsSubnet)
- if err != nil {
- logrus.Warn("failed to determine gatewayIP: ", err.Error())
+ } else if c.config.NetMode.IsSlirp4netns() {
+ gatewayIP, err := GetSlirp4netnsGateway(c.slirp4netnsSubnet)
+ if err != nil {
+ logrus.Warn("failed to determine gatewayIP: ", err.Error())
+ } else {
+ hosts += fmt.Sprintf("%s host.containers.internal\n", gatewayIP.String())
+ }
} else {
- hosts += fmt.Sprintf("%s host.containers.internal\n", gatewayIP.String())
+ logrus.Debug("network configuration does not support host.containers.internal address")
}
- } else {
- logrus.Debug("network configuration does not support host.containers.internal address")
}
return hosts
diff --git a/libpod/container_internal_unsupported.go b/libpod/container_internal_unsupported.go
deleted file mode 100644
index 125329ce5..000000000
--- a/libpod/container_internal_unsupported.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-
- "github.com/containers/podman/v3/libpod/define"
- "github.com/containers/podman/v3/pkg/lookup"
- spec "github.com/opencontainers/runtime-spec/specs-go"
-)
-
-func (c *Container) mountSHM(shmOptions string) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) unmountSHM(mount string) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) prepare() error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) cleanupNetwork() error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
- return nil, define.ErrNotImplemented
-}
-
-func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointOptions) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) restore(ctx context.Context, options ContainerCheckpointOptions) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) copyOwnerAndPerms(source, dest string) error {
- return nil
-}
-
-func (c *Container) getOCICgroupPath() (string, error) {
- return "", define.ErrNotImplemented
-}
-
-func (c *Container) cleanupOverlayMounts() error {
- return nil
-}
-
-func (c *Container) reloadNetwork() error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) getUserOverrides() *lookup.Overrides {
- return nil
-}
-
-// Fix ownership and permissions of the specified volume if necessary.
-func (c *Container) fixVolumePermissions(v *ContainerNamedVolume) error {
- return define.ErrNotImplemented
-}
diff --git a/libpod/container_stat_unsupported.go b/libpod/container_stat_unsupported.go
deleted file mode 100644
index c002e4d32..000000000
--- a/libpod/container_stat_unsupported.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (c *Container) stat(ctx context.Context, containerMountPoint string, containerPath string) (*define.FileInfo, string, string, error) {
- return nil, "", "", nil
-}
diff --git a/libpod/container_top_unsupported.go b/libpod/container_top_unsupported.go
deleted file mode 100644
index 1a096d248..000000000
--- a/libpod/container_top_unsupported.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build !linux
-
-package libpod
-
-import "github.com/containers/podman/v3/libpod/define"
-
-// Top gathers statistics about the running processes in a container. It returns a
-// []string for output
-func (c *Container) Top(descriptors []string) ([]string, error) {
- return nil, define.ErrNotImplemented
-}
-
-// GetContainerPidInformation returns process-related data of all processes in
-// the container. The output data can be controlled via the `descriptors`
-// argument which expects format descriptors and supports all AIXformat
-// descriptors of ps (1) plus some additional ones to for instance inspect the
-// set of effective capabilities. Each element in the returned string slice
-// is a tab-separated string.
-//
-// For more details, please refer to github.com/containers/psgo.
-func (c *Container) GetContainerPidInformation(descriptors []string) ([]string, error) {
- return nil, define.ErrNotImplemented
-}
diff --git a/libpod/container_unsupported.go b/libpod/container_unsupported.go
deleted file mode 100644
index e214b9465..000000000
--- a/libpod/container_unsupported.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// +build !linux
-
-package libpod
-
-type containerPlatformState struct{}
diff --git a/libpod/events/events.go b/libpod/events/events.go
index e03215eff..16dd6424e 100644
--- a/libpod/events/events.go
+++ b/libpod/events/events.go
@@ -6,6 +6,7 @@ import (
"os"
"time"
+ "github.com/containers/storage/pkg/stringid"
"github.com/hpcloud/tail"
"github.com/pkg/errors"
)
@@ -65,11 +66,15 @@ func (e *Event) ToJSONString() (string, error) {
}
// ToHumanReadable returns human readable event as a formatted string
-func (e *Event) ToHumanReadable() string {
+func (e *Event) ToHumanReadable(truncate bool) string {
var humanFormat string
+ id := e.ID
+ if truncate {
+ id = stringid.TruncateID(id)
+ }
switch e.Type {
case Container, Pod:
- humanFormat = fmt.Sprintf("%s %s %s %s (image=%s, name=%s", e.Time, e.Type, e.Status, e.ID, e.Image, e.Name)
+ humanFormat = fmt.Sprintf("%s %s %s %s (image=%s, name=%s", e.Time, e.Type, e.Status, id, e.Image, e.Name)
// check if the container has labels and add it to the output
if len(e.Attributes) > 0 {
for k, v := range e.Attributes {
@@ -78,9 +83,9 @@ func (e *Event) ToHumanReadable() string {
}
humanFormat += ")"
case Network:
- humanFormat = fmt.Sprintf("%s %s %s %s (container=%s, name=%s)", e.Time, e.Type, e.Status, e.ID, e.ID, e.Network)
+ humanFormat = fmt.Sprintf("%s %s %s %s (container=%s, name=%s)", e.Time, e.Type, e.Status, id, id, e.Network)
case Image:
- humanFormat = fmt.Sprintf("%s %s %s %s %s", e.Time, e.Type, e.Status, e.ID, e.Name)
+ humanFormat = fmt.Sprintf("%s %s %s %s %s", e.Time, e.Type, e.Status, id, e.Name)
case System:
humanFormat = fmt.Sprintf("%s %s %s", e.Time, e.Type, e.Status)
case Volume:
diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go
index a3e0d9754..3e16d8679 100644
--- a/libpod/events/journal_linux.go
+++ b/libpod/events/journal_linux.go
@@ -63,7 +63,7 @@ func (e EventJournalD) Write(ee Event) error {
case Volume:
m["PODMAN_NAME"] = ee.Name
}
- return journal.Send(string(ee.ToHumanReadable()), journal.PriInfo, m)
+ return journal.Send(string(ee.ToHumanReadable(false)), journal.PriInfo, m)
}
// Read reads events from the journal and sends qualified events to the event channel
diff --git a/libpod/healthcheck_unsupported.go b/libpod/healthcheck_unsupported.go
deleted file mode 100644
index 8b6a0209b..000000000
--- a/libpod/healthcheck_unsupported.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build !linux
-
-package libpod
-
-import "github.com/containers/podman/v3/libpod/define"
-
-// createTimer systemd timers for healthchecks of a container
-func (c *Container) createTimer() error {
- return define.ErrNotImplemented
-}
-
-// startTimer starts a systemd timer for the healthchecks
-func (c *Container) startTimer() error {
- return define.ErrNotImplemented
-}
-
-// removeTimer removes the systemd timer and unit files
-// for the container
-func (c *Container) removeTimer() error {
- return define.ErrNotImplemented
-}
diff --git a/libpod/network/cni/cni_conversion.go b/libpod/network/cni/cni_conversion.go
index 060794ebe..d69dd7eb3 100644
--- a/libpod/network/cni/cni_conversion.go
+++ b/libpod/network/cni/cni_conversion.go
@@ -81,20 +81,24 @@ func createNetworkFromCNIConfigList(conf *libcni.NetworkConfigList, confPath str
return nil, err
}
- case types.MacVLANNetworkDriver:
- var macvlan macVLANConfig
- err := json.Unmarshal(firstPlugin.Bytes, &macvlan)
+ case types.MacVLANNetworkDriver, types.IPVLANNetworkDriver:
+ var vlan VLANConfig
+ err := json.Unmarshal(firstPlugin.Bytes, &vlan)
if err != nil {
return nil, errors.Wrapf(err, "failed to unmarshal the macvlan plugin config in %s", confPath)
}
- network.NetworkInterface = macvlan.Master
+ network.NetworkInterface = vlan.Master
// set network options
- if macvlan.MTU != 0 {
- network.Options["mtu"] = strconv.Itoa(macvlan.MTU)
+ if vlan.MTU != 0 {
+ network.Options["mtu"] = strconv.Itoa(vlan.MTU)
+ }
+
+ if vlan.Mode != "" {
+ network.Options["mode"] = vlan.Mode
}
- err = convertIPAMConfToNetwork(&network, macvlan.IPAM, confPath)
+ err = convertIPAMConfToNetwork(&network, vlan.IPAM, confPath)
if err != nil {
return nil, err
}
@@ -207,7 +211,7 @@ func getNetworkArgsFromConfList(args map[string]interface{}, argType string) map
return result
}
}
- return nil
+ return map[string]string{}
}
// createCNIConfigListFromNetwork will create a cni config file from the given network.
@@ -237,6 +241,7 @@ func (n *cniNetwork) createCNIConfigListFromNetwork(network *types.Network, writ
vlan := 0
mtu := 0
+ vlanPluginMode := ""
for k, v := range network.Options {
switch k {
case "mtu":
@@ -251,6 +256,21 @@ func (n *cniNetwork) createCNIConfigListFromNetwork(network *types.Network, writ
return nil, "", err
}
+ case "mode":
+ switch network.Driver {
+ case types.MacVLANNetworkDriver:
+ if !pkgutil.StringInSlice(v, []string{"", "bridge", "private", "vepa", "passthru"}) {
+ return nil, "", errors.Errorf("unknown macvlan mode %q", v)
+ }
+ case types.IPVLANNetworkDriver:
+ if !pkgutil.StringInSlice(v, []string{"", "l2", "l3", "l3s"}) {
+ return nil, "", errors.Errorf("unknown ipvlan mode %q", v)
+ }
+ default:
+ return nil, "", errors.Errorf("cannot set option \"mode\" with driver %q", network.Driver)
+ }
+ vlanPluginMode = v
+
default:
return nil, "", errors.Errorf("unsupported network option %s", k)
}
@@ -281,7 +301,10 @@ func (n *cniNetwork) createCNIConfigListFromNetwork(network *types.Network, writ
}
case types.MacVLANNetworkDriver:
- plugins = append(plugins, newMacVLANPlugin(network.NetworkInterface, mtu, ipamConf))
+ plugins = append(plugins, newVLANPlugin(types.MacVLANNetworkDriver, network.NetworkInterface, vlanPluginMode, mtu, ipamConf))
+
+ case types.IPVLANNetworkDriver:
+ plugins = append(plugins, newVLANPlugin(types.IPVLANNetworkDriver, network.NetworkInterface, vlanPluginMode, mtu, ipamConf))
default:
return nil, "", errors.Errorf("driver %q is not supported by cni", network.Driver)
diff --git a/libpod/network/cni/cni_types.go b/libpod/network/cni/cni_types.go
index 91fd1c27b..fbf917c2d 100644
--- a/libpod/network/cni/cni_types.go
+++ b/libpod/network/cni/cni_types.go
@@ -50,7 +50,7 @@ type hostLocalBridge struct {
PromiscMode bool `json:"promiscMode,omitempty"`
Vlan int `json:"vlan,omitempty"`
IPAM ipamConfig `json:"ipam"`
- Capabilities map[string]bool `json:"capabilities"`
+ Capabilities map[string]bool `json:"capabilities,omitempty"`
}
// ipamConfig describes an IPAM configuration
@@ -82,13 +82,14 @@ type portMapConfig struct {
Capabilities map[string]bool `json:"capabilities"`
}
-// macVLANConfig describes the macvlan config
-type macVLANConfig struct {
+// VLANConfig describes the macvlan config
+type VLANConfig struct {
PluginType string `json:"type"`
Master string `json:"master"`
IPAM ipamConfig `json:"ipam"`
MTU int `json:"mtu,omitempty"`
- Capabilities map[string]bool `json:"capabilities"`
+ Mode string `json:"mode,omitempty"`
+ Capabilities map[string]bool `json:"capabilities,omitempty"`
}
// firewallConfig describes the firewall plugin
@@ -259,15 +260,18 @@ func hasDNSNamePlugin(paths []string) bool {
return false
}
-// newMacVLANPlugin creates a macvlanconfig with a given device name
-func newMacVLANPlugin(device string, mtu int, ipam ipamConfig) macVLANConfig {
- m := macVLANConfig{
- PluginType: "macvlan",
+// newVLANPlugin creates a macvlanconfig with a given device name
+func newVLANPlugin(pluginType, device, mode string, mtu int, ipam ipamConfig) VLANConfig {
+ m := VLANConfig{
+ PluginType: pluginType,
IPAM: ipam,
}
if mtu > 0 {
m.MTU = mtu
}
+ if len(mode) > 0 {
+ m.Mode = mode
+ }
// CNI is supposed to use the default route if a
// parent device is not provided
if len(device) > 0 {
diff --git a/libpod/network/cni/config.go b/libpod/network/cni/config.go
index d31cd3002..2a6ad8eb3 100644
--- a/libpod/network/cni/config.go
+++ b/libpod/network/cni/config.go
@@ -100,8 +100,8 @@ func (n *cniNetwork) networkCreate(newNetwork types.Network, defaultNet bool) (*
if err != nil {
return nil, err
}
- case types.MacVLANNetworkDriver:
- err = createMacVLAN(&newNetwork)
+ case types.MacVLANNetworkDriver, types.IPVLANNetworkDriver:
+ err = createIPMACVLAN(&newNetwork)
if err != nil {
return nil, err
}
@@ -214,7 +214,7 @@ func (n *cniNetwork) NetworkInspect(nameOrID string) (types.Network, error) {
return *network.libpodNet, nil
}
-func createMacVLAN(network *types.Network) error {
+func createIPMACVLAN(network *types.Network) error {
if network.Internal {
return errors.New("internal is not supported with macvlan")
}
diff --git a/libpod/network/cni/config_test.go b/libpod/network/cni/config_test.go
index 11ad71870..a0a0ea1af 100644
--- a/libpod/network/cni/config_test.go
+++ b/libpod/network/cni/config_test.go
@@ -250,6 +250,67 @@ var _ = Describe("Config", func() {
grepInFile(path, `"type": "host-local"`)
})
+ It("create ipvlan config with subnet", func() {
+ subnet := "10.1.0.0/24"
+ n, _ := types.ParseCIDR(subnet)
+ network := types.Network{
+ Driver: "ipvlan",
+ Subnets: []types.Subnet{
+ {Subnet: n},
+ },
+ }
+ network1, err := libpodNet.NetworkCreate(network)
+ Expect(err).To(BeNil())
+ Expect(network1.Name).ToNot(BeEmpty())
+ path := filepath.Join(cniConfDir, network1.Name+".conflist")
+ Expect(path).To(BeARegularFile())
+ Expect(network1.ID).ToNot(BeEmpty())
+ Expect(network1.Driver).To(Equal("ipvlan"))
+ Expect(network1.Labels).To(BeEmpty())
+ Expect(network1.Options).To(BeEmpty())
+ Expect(network1.Subnets).To(HaveLen(1))
+ Expect(network1.Subnets[0].Subnet.String()).To(Equal(subnet))
+ Expect(network1.Subnets[0].Gateway.String()).To(Equal("10.1.0.1"))
+ Expect(network1.Subnets[0].LeaseRange).To(BeNil())
+ Expect(network1.DNSEnabled).To(BeFalse())
+ Expect(network1.Internal).To(BeFalse())
+ Expect(network1.IPAMOptions).To(HaveKeyWithValue("driver", "host-local"))
+ grepInFile(path, `"type": "host-local"`)
+ })
+
+ It("create macvlan config with mode", func() {
+ for _, mode := range []string{"bridge", "private", "vepa", "passthru"} {
+ network := types.Network{
+ Driver: "macvlan",
+ Options: map[string]string{
+ "mode": mode,
+ },
+ }
+ network1, err := libpodNet.NetworkCreate(network)
+ Expect(err).To(BeNil())
+ Expect(network1.Name).ToNot(BeEmpty())
+ path := filepath.Join(cniConfDir, network1.Name+".conflist")
+ Expect(path).To(BeARegularFile())
+ Expect(network1.Driver).To(Equal("macvlan"))
+ Expect(network1.Options).To(HaveKeyWithValue("mode", mode))
+ Expect(network1.IPAMOptions).ToNot(BeEmpty())
+ Expect(network1.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
+ grepInFile(path, `"mode": "`+mode+`"`)
+ }
+ })
+
+ It("create macvlan config with invalid mode", func() {
+ network := types.Network{
+ Driver: "macvlan",
+ Options: map[string]string{
+ "mode": "test",
+ },
+ }
+ _, err := libpodNet.NetworkCreate(network)
+ Expect(err).To(HaveOccurred())
+ Expect(err.Error()).To(ContainSubstring(`unknown macvlan mode "test"`))
+ })
+
It("create macvlan config with invalid device", func() {
network := types.Network{
Driver: "macvlan",
@@ -270,6 +331,47 @@ var _ = Describe("Config", func() {
Expect(err.Error()).To(ContainSubstring("internal is not supported with macvlan"))
})
+ It("create ipvlan config with mode", func() {
+ for _, mode := range []string{"l2", "l3", "l3s"} {
+ network := types.Network{
+ Driver: "ipvlan",
+ Options: map[string]string{
+ "mode": mode,
+ },
+ }
+ network1, err := libpodNet.NetworkCreate(network)
+ Expect(err).To(BeNil())
+ Expect(network1.Name).ToNot(BeEmpty())
+ path := filepath.Join(cniConfDir, network1.Name+".conflist")
+ Expect(path).To(BeARegularFile())
+ Expect(network1.Driver).To(Equal("ipvlan"))
+ Expect(network1.Options).To(HaveKeyWithValue("mode", mode))
+ Expect(network1.IPAMOptions).ToNot(BeEmpty())
+ Expect(network1.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
+ grepInFile(path, `"mode": "`+mode+`"`)
+
+ // reload configs from disk
+ libpodNet, err = getNetworkInterface(cniConfDir, false)
+ Expect(err).To(BeNil())
+
+ network2, err := libpodNet.NetworkInspect(network1.Name)
+ Expect(err).To(BeNil())
+ Expect(network2).To(Equal(network1))
+ }
+ })
+
+ It("create ipvlan config with invalid mode", func() {
+ network := types.Network{
+ Driver: "ipvlan",
+ Options: map[string]string{
+ "mode": "test",
+ },
+ }
+ _, err := libpodNet.NetworkCreate(network)
+ Expect(err).To(HaveOccurred())
+ Expect(err.Error()).To(ContainSubstring(`unknown ipvlan mode "test"`))
+ })
+
It("create bridge with subnet", func() {
subnet := "10.0.0.0/24"
n, _ := types.ParseCIDR(subnet)
diff --git a/libpod/network/cni/network.go b/libpod/network/cni/network.go
index 46e07f780..d77e63a5d 100644
--- a/libpod/network/cni/network.go
+++ b/libpod/network/cni/network.go
@@ -109,7 +109,7 @@ func NewCNINetworkInterface(conf InitConfig) (types.ContainerNetwork, error) {
// Drivers will return the list of supported network drivers
// for this interface.
func (n *cniNetwork) Drivers() []string {
- return []string{types.BridgeNetworkDriver, types.MacVLANNetworkDriver}
+ return []string{types.BridgeNetworkDriver, types.MacVLANNetworkDriver, types.IPVLANNetworkDriver}
}
func (n *cniNetwork) loadNetworks() error {
diff --git a/libpod/network/types/const.go b/libpod/network/types/const.go
index be7ef03cf..916c6e6bf 100644
--- a/libpod/network/types/const.go
+++ b/libpod/network/types/const.go
@@ -7,6 +7,8 @@ const (
DefaultNetworkDriver = BridgeNetworkDriver
// MacVLANNetworkDriver defines the macvlan driver
MacVLANNetworkDriver = "macvlan"
+ // MacVLANNetworkDriver defines the macvlan driver
+ IPVLANNetworkDriver = "ipvlan"
// IPAM drivers
// HostLocalIPAMDriver store the ip
diff --git a/libpod/networking_unsupported.go b/libpod/networking_unsupported.go
deleted file mode 100644
index 20c27ca7f..000000000
--- a/libpod/networking_unsupported.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- cnitypes "github.com/containernetworking/cni/pkg/types/current"
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (r *Runtime) setupRootlessNetNS(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) setupSlirp4netns(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) setupNetNS(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) teardownNetNS(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) createNetNS(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, error) {
- return nil, define.ErrNotImplemented
-}
-
-func (r *Runtime) reloadContainerNetwork(ctr *Container) ([]*cnitypes.Result, error) {
- return nil, define.ErrNotImplemented
-}
-
-func getCNINetworksDir() (string, error) {
- return "", define.ErrNotImplemented
-}
diff --git a/libpod/oci_attach_unsupported.go b/libpod/oci_attach_unsupported.go
deleted file mode 100644
index 85e8b32e6..000000000
--- a/libpod/oci_attach_unsupported.go
+++ /dev/null
@@ -1,17 +0,0 @@
-//+build !linux
-
-package libpod
-
-import (
- "os"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (c *Container) attach(streams *define.AttachStreams, keys string, resize <-chan define.TerminalSize, startContainer bool, started chan bool, attachRdy chan<- bool) error {
- return define.ErrNotImplemented
-}
-
-func (c *Container) attachToExec(streams *define.AttachStreams, keys string, resize <-chan define.TerminalSize, sessionID string, startFd *os.File, attachFd *os.File) error {
- return define.ErrNotImplemented
-}
diff --git a/libpod/oci_conmon_unsupported.go b/libpod/oci_conmon_unsupported.go
deleted file mode 100644
index 4de27d663..000000000
--- a/libpod/oci_conmon_unsupported.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "github.com/containers/common/pkg/config"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-const (
- osNotSupported = "Not supported on this OS"
-)
-
-// ConmonOCIRuntime is not supported on this OS.
-type ConmonOCIRuntime struct {
-}
-
-// newConmonOCIRuntime is not supported on this OS.
-func newConmonOCIRuntime(name string, paths []string, conmonPath string, runtimeFlags []string, runtimeCfg *config.Config) (OCIRuntime, error) {
- return nil, define.ErrNotImplemented
-}
-
-// Name is not supported on this OS.
-func (r *ConmonOCIRuntime) Name() string {
- return osNotSupported
-}
-
-// Path is not supported on this OS.
-func (r *ConmonOCIRuntime) Path() string {
- return osNotSupported
-}
-
-// CreateContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) CreateContainer(ctr *Container, restoreOptions *ContainerCheckpointOptions) error {
- return define.ErrNotImplemented
-}
-
-// UpdateContainerStatus is not supported on this OS.
-func (r *ConmonOCIRuntime) UpdateContainerStatus(ctr *Container, useRuntime bool) error {
- return define.ErrNotImplemented
-}
-
-// StartContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) StartContainer(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-// KillContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) KillContainer(ctr *Container, signal uint, all bool) error {
- return define.ErrNotImplemented
-}
-
-// StopContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) StopContainer(ctr *Container, timeout uint, all bool) error {
- return define.ErrNotImplemented
-}
-
-// DeleteContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) DeleteContainer(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-// PauseContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) PauseContainer(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-// UnpauseContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) UnpauseContainer(ctr *Container) error {
- return define.ErrNotImplemented
-}
-
-// ExecContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) ExecContainer(ctr *Container, sessionID string, options *ExecOptions) (int, chan error, error) {
- return -1, nil, define.ErrNotImplemented
-}
-
-// ExecStopContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) ExecStopContainer(ctr *Container, sessionID string, timeout uint) error {
- return define.ErrNotImplemented
-}
-
-// CheckpointContainer is not supported on this OS.
-func (r *ConmonOCIRuntime) CheckpointContainer(ctr *Container, options ContainerCheckpointOptions) error {
- return define.ErrNotImplemented
-}
-
-// SupportsCheckpoint is not supported on this OS.
-func (r *ConmonOCIRuntime) SupportsCheckpoint() bool {
- return false
-}
-
-// SupportsJSONErrors is not supported on this OS.
-func (r *ConmonOCIRuntime) SupportsJSONErrors() bool {
- return false
-}
-
-// SupportsNoCgroups is not supported on this OS.
-func (r *ConmonOCIRuntime) SupportsNoCgroups() bool {
- return false
-}
-
-// AttachSocketPath is not supported on this OS.
-func (r *ConmonOCIRuntime) AttachSocketPath(ctr *Container) (string, error) {
- return "", define.ErrNotImplemented
-}
-
-// ExecAttachSocketPath is not supported on this OS.
-func (r *ConmonOCIRuntime) ExecAttachSocketPath(ctr *Container, sessionID string) (string, error) {
- return "", define.ErrNotImplemented
-}
-
-// ExitFilePath is not supported on this OS.
-func (r *ConmonOCIRuntime) ExitFilePath(ctr *Container) (string, error) {
- return "", define.ErrNotImplemented
-}
-
-// RuntimeInfo is not supported on this OS.
-func (r *ConmonOCIRuntime) RuntimeInfo() (*define.ConmonInfo, *define.OCIRuntimeInfo, error) {
- return nil, nil, define.ErrNotImplemented
-}
-
-// Package is not supported on this OS.
-func (r *ConmonOCIRuntime) Package() string {
- return osNotSupported
-}
-
-// ConmonPackage is not supported on this OS.
-func (r *ConmonOCIRuntime) ConmonPackage() string {
- return osNotSupported
-}
diff --git a/libpod/pod_top_unsupported.go b/libpod/pod_top_unsupported.go
deleted file mode 100644
index 59d2ff9a2..000000000
--- a/libpod/pod_top_unsupported.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build !linux
-
-package libpod
-
-import "github.com/containers/podman/v3/libpod/define"
-
-// GetPodPidInformation is exclusive to linux
-func (p *Pod) GetPodPidInformation(descriptors []string) ([]string, error) {
- return nil, define.ErrNotImplemented
-}
diff --git a/libpod/runtime.go b/libpod/runtime.go
index d2b3d36da..a2279e56d 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -35,6 +35,7 @@ import (
"github.com/containers/podman/v3/pkg/rootless"
"github.com/containers/podman/v3/pkg/systemd"
"github.com/containers/podman/v3/pkg/util"
+ "github.com/containers/podman/v3/utils"
"github.com/containers/storage"
"github.com/containers/storage/pkg/unshare"
"github.com/docker/docker/pkg/namesgenerator"
@@ -543,6 +544,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
return err
}
if became {
+ utils.MovePauseProcessToScope(pausePid)
os.Exit(ret)
}
}
diff --git a/libpod/runtime_migrate_unsupported.go b/libpod/runtime_migrate_unsupported.go
deleted file mode 100644
index a9d351318..000000000
--- a/libpod/runtime_migrate_unsupported.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-)
-
-func (r *Runtime) migrate(ctx context.Context) error {
- return nil
-}
-
-func (r *Runtime) stopPauseProcess() error {
- return nil
-}
diff --git a/libpod/runtime_pod_unsupported.go b/libpod/runtime_pod_unsupported.go
deleted file mode 100644
index 6dbcc9214..000000000
--- a/libpod/runtime_pod_unsupported.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-// NewPod makes a new, empty pod
-func (r *Runtime) NewPod(ctx context.Context, options ...PodCreateOption) (*Pod, error) {
- return nil, define.ErrOSNotSupported
-}
-
-func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool) error {
- return define.ErrOSNotSupported
-}
diff --git a/libpod/runtime_volume_unsupported.go b/libpod/runtime_volume_unsupported.go
deleted file mode 100644
index da7ee3552..000000000
--- a/libpod/runtime_volume_unsupported.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "context"
-
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (r *Runtime) removeVolume(ctx context.Context, v *Volume, force bool) error {
- return define.ErrNotImplemented
-}
-
-func (r *Runtime) newVolume(ctx context.Context, options ...VolumeCreateOption) (*Volume, error) {
- return nil, define.ErrNotImplemented
-}
-
-func (r *Runtime) NewVolume(ctx context.Context, options ...VolumeCreateOption) (*Volume, error) {
- return nil, define.ErrNotImplemented
-}
diff --git a/libpod/stats_unsupported.go b/libpod/stats_unsupported.go
deleted file mode 100644
index 44a1c8d03..000000000
--- a/libpod/stats_unsupported.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build !linux
-
-package libpod
-
-import "github.com/containers/podman/v3/libpod/define"
-
-// GetContainerStats gets the running stats for a given container
-func (c *Container) GetContainerStats(previousStats *define.ContainerStats) (*define.ContainerStats, error) {
- return nil, define.ErrOSNotSupported
-}
diff --git a/libpod/util_unsupported.go b/libpod/util_unsupported.go
deleted file mode 100644
index b718d36aa..000000000
--- a/libpod/util_unsupported.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "github.com/containers/podman/v3/libpod/define"
- "github.com/pkg/errors"
-)
-
-func systemdSliceFromPath(parent, name string) (string, error) {
- return "", errors.Wrapf(define.ErrOSNotSupported, "cgroups are not supported on non-linux OSes")
-}
-
-func makeSystemdCgroup(path string) error {
- return errors.Wrapf(define.ErrOSNotSupported, "cgroups are not supported on non-linux OSes")
-}
-
-func deleteSystemdCgroup(path string) error {
- return errors.Wrapf(define.ErrOSNotSupported, "cgroups are not supported on non-linux OSes")
-}
-
-func assembleSystemdCgroupName(baseSlice, newSlice string) (string, error) {
- return "", errors.Wrapf(define.ErrOSNotSupported, "cgroups are not supported on non-linux OSes")
-}
-
-// LabelVolumePath takes a mount path for a volume and gives it an
-// selinux label of either shared or not
-func LabelVolumePath(path string) error {
- return define.ErrNotImplemented
-}
-
-func Unmount(mount string) error {
- return define.ErrNotImplemented
-}
diff --git a/libpod/volume_internal_unsupported.go b/libpod/volume_internal_unsupported.go
deleted file mode 100644
index 77452cf22..000000000
--- a/libpod/volume_internal_unsupported.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !linux
-
-package libpod
-
-import (
- "github.com/containers/podman/v3/libpod/define"
-)
-
-func (v *Volume) mount() error {
- return define.ErrNotImplemented
-}
-
-func (v *Volume) unmount(force bool) error {
- return define.ErrNotImplemented
-}