summaryrefslogtreecommitdiff
path: root/libpod/sql_state_internal.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2017-12-06 15:54:59 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-14 23:59:21 +0000
commit0ff92f8e20edb46eb8a9d82b929e153bcdaa3044 (patch)
tree14289c5dea9b738004837144ec6c5045d2f4789d /libpod/sql_state_internal.go
parent824a648fcb87c112fb498db94b8e39a84ba649bd (diff)
downloadpodman-0ff92f8e20edb46eb8a9d82b929e153bcdaa3044.tar.gz
podman-0ff92f8e20edb46eb8a9d82b929e153bcdaa3044.tar.bz2
podman-0ff92f8e20edb46eb8a9d82b929e153bcdaa3044.zip
Add network namespaces to SQL state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #109 Approved by: mheon
Diffstat (limited to 'libpod/sql_state_internal.go')
-rw-r--r--libpod/sql_state_internal.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/libpod/sql_state_internal.go b/libpod/sql_state_internal.go
index 1d1878b9d..e1ecc8ea6 100644
--- a/libpod/sql_state_internal.go
+++ b/libpod/sql_state_internal.go
@@ -200,6 +200,7 @@ func prepareDB(db *sql.DB) (err error) {
ExitCode INTEGER NOT NULL,
OomKilled INTEGER NOT NULL,
Pid INTEGER NOT NULL,
+ NetNSPath TEXT NOT NULL,
CHECK (State>0),
CHECK (OomKilled IN (0, 1)),
FOREIGN KEY (Id) REFERENCES containers(Id) DEFERRABLE INITIALLY DEFERRED
@@ -296,6 +297,7 @@ func ctrFromScannable(row scannable, runtime *Runtime, specsDir string, lockDir
exitCode int32
oomKilled int
pid int
+ netNSPath string
)
err := row.Scan(
@@ -323,7 +325,8 @@ func ctrFromScannable(row scannable, runtime *Runtime, specsDir string, lockDir
&finishedTimeString,
&exitCode,
&oomKilled,
- &pid)
+ &pid,
+ &netNSPath)
if err != nil {
if err == sql.ErrNoRows {
return nil, ErrNoSuchCtr
@@ -394,6 +397,15 @@ func ctrFromScannable(row scannable, runtime *Runtime, specsDir string, lockDir
}
ctr.state.FinishedTime = finishedTime
+ // Join the network namespace, if there is one
+ if netNSPath != "" {
+ netNS, err := joinNetNS(netNSPath)
+ if err != nil {
+ return nil, errors.Wrapf(err, "error joining network namespace for container %s", id)
+ }
+ ctr.state.NetNS = netNS
+ }
+
ctr.valid = true
ctr.runtime = runtime