summaryrefslogtreecommitdiff
path: root/libpod/container_inspect.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-07 14:10:19 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-08 16:40:21 +0000
commit54f32f2cc024090c3f284f7b0b6832f2b19a6660 (patch)
treef3a221a9d1fe522afa9f43cb72b4cb94552788d0 /libpod/container_inspect.go
parentc657511bce7bc1c5da4b5554a4850aa4046711b0 (diff)
downloadpodman-54f32f2cc024090c3f284f7b0b6832f2b19a6660.tar.gz
podman-54f32f2cc024090c3f284f7b0b6832f2b19a6660.tar.bz2
podman-54f32f2cc024090c3f284f7b0b6832f2b19a6660.zip
Convert bind mounts to use DB field
Refactors creation of bind mounts into a separate function that can be called from elsewhere (e.g. pod start or container restart). This function stores the mounts in the DB using the field established last commit. Spec generation now relies upon this field in the DB instead of manually enumerating files to be bind mounted in. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #462 Approved by: baude
Diffstat (limited to 'libpod/container_inspect.go')
-rw-r--r--libpod/container_inspect.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index 3a1728826..bbfcd4446 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -25,6 +25,25 @@ func (c *Container) getContainerInspectData(size bool, driverData *inspect.Data)
execIDs = append(execIDs, id)
}
+ if c.state.BindMounts == nil {
+ c.state.BindMounts = make(map[string]string)
+ }
+
+ resolvPath := ""
+ if path, ok := c.state.BindMounts["/etc/resolv.conf"]; ok {
+ resolvPath = path
+ }
+
+ hostsPath := ""
+ if path, ok := c.state.BindMounts["/etc/hosts"]; ok {
+ hostsPath = path
+ }
+
+ hostnamePath := ""
+ if path, ok := c.state.BindMounts["/etc/hostname"]; ok {
+ hostnamePath = path
+ }
+
data := &inspect.ContainerInspectData{
ID: config.ID,
Created: config.CreatedTime,
@@ -45,9 +64,9 @@ func (c *Container) getContainerInspectData(size bool, driverData *inspect.Data)
},
ImageID: config.RootfsImageID,
ImageName: config.RootfsImageName,
- ResolvConfPath: "", // TODO get from networking path
- HostnamePath: spec.Annotations["io.kubernetes.cri-o.HostnamePath"], // not sure
- HostsPath: "", // can't get yet
+ ResolvConfPath: resolvPath,
+ HostnamePath: hostnamePath,
+ HostsPath: hostsPath,
StaticDir: config.StaticDir,
LogPath: config.LogPath,
Name: config.Name,