From 419dd8a7781aa5c802e4150d17dfcb0f24e19e36 Mon Sep 17 00:00:00 2001 From: Vishnu Kannan Date: Mon, 9 Nov 2015 15:32:31 -0800 Subject: [PATCH] Include log usage for aufs driver. Signed-off-by: Vishnu Kannan --- container/docker/handler.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/container/docker/handler.go b/container/docker/handler.go index ca8e9d80..f58d15ad 100644 --- a/container/docker/handler.go +++ b/container/docker/handler.go @@ -36,7 +36,10 @@ import ( // Path to aufs dir where all the files exist. // aufs/layers is ignored here since it does not hold a lot of data. // aufs/mnt contains the mount points used to compose the rootfs. Hence it is also ignored. -var pathToAufsDir = "aufs/diff" +const ( + pathToAufsDir = "aufs/diff" + pathToContainersDir = "containers" +) type dockerContainerHandler struct { client *docker.Client @@ -118,7 +121,14 @@ func newDockerContainerHandler( id := ContainerNameToDockerId(name) - storageDirs := []string{path.Join(*dockerRootDir, pathToAufsDir, id)} + // Add the Containers dir where the log files are stored. + storageDirs := []string{path.Join(*dockerRootDir, pathToContainersDir, id)} + + switch storageDriver { + case aufsStorageDriver: + // Add writable layer for aufs. + storageDirs = append(storageDirs, path.Join(*dockerRootDir, pathToAufsDir, id)) + } handler := &dockerContainerHandler{ id: id, @@ -134,10 +144,8 @@ func newDockerContainerHandler( fsHandler: newFsHandler(time.Minute, storageDirs, fsInfo), } - switch storageDriver { - case aufsStorageDriver: - handler.fsHandler.start() - } + // Start the filesystem handler. + handler.fsHandler.start() // We assume that if Inspect fails then the container is not known to docker. ctnr, err := client.InspectContainer(id)