diff options
Diffstat (limited to 'libpod/sql_state_internal.go')
-rw-r--r-- | libpod/sql_state_internal.go | 14 |
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 |