diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-03-31 19:58:31 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-03 14:57:16 +0000 |
commit | a1c0f18bcac9e0b21b4abbb4e49bea4336842e4e (patch) | |
tree | c54147b99c04f02b528857840310f43213c7608b /libpod/container.go | |
parent | 838df4eec4496868e772d5708e00f38bad478718 (diff) | |
download | podman-a1c0f18bcac9e0b21b4abbb4e49bea4336842e4e.tar.gz podman-a1c0f18bcac9e0b21b4abbb4e49bea4336842e4e.tar.bz2 podman-a1c0f18bcac9e0b21b4abbb4e49bea4336842e4e.zip |
Add backend code for generic dependencies
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #577
Approved by: rhatdan
Diffstat (limited to 'libpod/container.go')
-rw-r--r-- | libpod/container.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go index 965ac67fe..cbfa09538 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -205,6 +205,8 @@ type ContainerConfig struct { // Namespace Config // IDs of container to share namespaces with // NetNsCtr conflicts with the CreateNetNS bool + // These containers are considered dependencies of the given container + // They must be started before the given container is started IPCNsCtr string `json:"ipcNsCtr,omitempty"` MountNsCtr string `json:"mountNsCtr,omitempty"` NetNsCtr string `json:"netNsCtr,omitempty"` @@ -213,6 +215,10 @@ type ContainerConfig struct { UTSNsCtr string `json:"utsNsCtr,omitempty"` CgroupNsCtr string `json:"cgroupNsCtr,omitempty"` + // IDs of dependency containers + // These containers must be started before this container is started + Dependencies []string + // Network Config // CreateNetNS indicates that libpod should create and configure a new // network namespace for the container @@ -363,6 +369,8 @@ func (c *Container) User() string { func (c *Container) Dependencies() []string { // Collect in a map first to remove dupes dependsCtrs := map[string]bool{} + + // First add all namespace containers if c.config.IPCNsCtr != "" { dependsCtrs[c.config.IPCNsCtr] = true } @@ -385,6 +393,11 @@ func (c *Container) Dependencies() []string { dependsCtrs[c.config.CgroupNsCtr] = true } + // Add all generic dependencies + for _, id := range c.config.Dependencies { + dependsCtrs[id] = true + } + if len(dependsCtrs) == 0 { return []string{} } |