summaryrefslogtreecommitdiff
path: root/libpod/pod.go
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-04-18 16:48:35 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-19 14:08:47 +0000
commit27107fdac1d75f97caab47cd13efb1d9900cf350 (patch)
treef5edafbb52505829b15e19ea6a9e66f4440e862b /libpod/pod.go
parent6a9dbf3305e93e5e1c3bff09402a9b801c935fbd (diff)
downloadpodman-27107fdac1d75f97caab47cd13efb1d9900cf350.tar.gz
podman-27107fdac1d75f97caab47cd13efb1d9900cf350.tar.bz2
podman-27107fdac1d75f97caab47cd13efb1d9900cf350.zip
Vendor in latest containers/image and contaners/storage
Made necessary changes to functions to include contex.Context wherever needed Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #640 Approved by: baude
Diffstat (limited to 'libpod/pod.go')
-rw-r--r--libpod/pod.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/libpod/pod.go b/libpod/pod.go
index 2126e9228..3cad3f817 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -1,6 +1,7 @@
package libpod
import (
+ "context"
"path/filepath"
"strings"
@@ -81,7 +82,7 @@ func newPod(lockDir string, runtime *Runtime) (*Pod, error) {
// containers. The container ID is mapped to the error encountered. The error is
// set to ErrCtrExists
// If both error and the map are nil, all containers were started successfully
-func (p *Pod) Start() (map[string]error, error) {
+func (p *Pod) Start(ctx context.Context) (map[string]error, error) {
p.lock.Lock()
defer p.lock.Unlock()
@@ -111,7 +112,7 @@ func (p *Pod) Start() (map[string]error, error) {
// Traverse the graph beginning at nodes with no dependencies
for _, node := range graph.noDepNodes {
- startNode(node, false, ctrErrors, ctrsVisited)
+ startNode(ctx, node, false, ctrErrors, ctrsVisited)
}
return ctrErrors, nil
@@ -119,7 +120,7 @@ func (p *Pod) Start() (map[string]error, error) {
// Visit a node on a container graph and start the container, or set an error if
// a dependency failed to start
-func startNode(node *containerNode, setError bool, ctrErrors map[string]error, ctrsVisited map[string]bool) {
+func startNode(ctx context.Context, node *containerNode, setError bool, ctrErrors map[string]error, ctrsVisited map[string]bool) {
// First, check if we have already visited the node
if ctrsVisited[node.id] {
return
@@ -134,7 +135,7 @@ func startNode(node *containerNode, setError bool, ctrErrors map[string]error, c
// Hit anyone who depends on us, and set errors on them too
for _, successor := range node.dependedOn {
- startNode(successor, true, ctrErrors, ctrsVisited)
+ startNode(ctx, successor, true, ctrErrors, ctrsVisited)
}
return
@@ -187,7 +188,7 @@ func startNode(node *containerNode, setError bool, ctrErrors map[string]error, c
// Start the container (only if it is not running)
if !ctrErrored && node.container.state.State != ContainerStateRunning {
- if err := node.container.initAndStart(); err != nil {
+ if err := node.container.initAndStart(ctx); err != nil {
ctrErrored = true
ctrErrors[node.id] = err
}
@@ -197,7 +198,7 @@ func startNode(node *containerNode, setError bool, ctrErrors map[string]error, c
// Recurse to anyone who depends on us and start them
for _, successor := range node.dependedOn {
- startNode(successor, ctrErrored, ctrErrors, ctrsVisited)
+ startNode(ctx, successor, ctrErrored, ctrErrors, ctrsVisited)
}
return