summaryrefslogtreecommitdiff
path: root/libpod/boltdb_state_linux.go
blob: 9238d22fefb3f2fb71511d68f151d190d909d6bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// +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
}