mirror of
https://github.com/containers/podman.git
synced 2025-10-25 18:25:59 +08:00
This just muves the Linux implementation, unchanged, to the platform-agnostic file. Should not change behavior on Linux. On non-Linux platforms, reading containers from BoltDB now works (and rejects containers with namespace data). The checkRuntimeConfig validation ensures that each BoltDB database is only used on one platform, so network namespaces should never exist in non-Linux BoltDB files. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1115 Approved by: rhatdan
26 lines
592 B
Go
26 lines
592 B
Go
// +build linux
|
|
|
|
package libpod
|
|
|
|
import (
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// parseNetNSBoltData sets ctr.state.NetNS, if any, from netNSBytes.
|
|
// Returns true if the data is valid.
|
|
func parseNetNSBoltData(ctr *Container, netNSBytes []byte) bool {
|
|
// The container may not have a network namespace, so it's OK if this is
|
|
// nil
|
|
if netNSBytes != nil {
|
|
nsPath := string(netNSBytes)
|
|
netNS, err := joinNetNS(nsPath)
|
|
if err == nil {
|
|
ctr.state.NetNS = netNS
|
|
} else {
|
|
logrus.Errorf("error joining network namespace for container %s", ctr.ID())
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|