From af7f81878f561ecdab32936d4bea72f0ab26ce0e Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Thu, 2 Jul 2015 18:24:35 +0800 Subject: [PATCH] Show error message when todisk failed Signed-off-by: Qiang Huang --- daemon/create.go | 2 ++ daemon/daemon.go | 4 ++-- daemon/delete.go | 4 +++- daemon/monitor.go | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/daemon/create.go b/daemon/create.go index 5eb536466c..d4f0db984f 100644 --- a/daemon/create.go +++ b/daemon/create.go @@ -6,6 +6,7 @@ import ( "path/filepath" "strings" + "github.com/Sirupsen/logrus" "github.com/docker/docker/graph" "github.com/docker/docker/image" "github.com/docker/docker/pkg/parsers" @@ -136,6 +137,7 @@ func (daemon *Daemon) Create(config *runconfig.Config, hostConfig *runconfig.Hos container.addMountPointWithVolume(destination, v, true) } if err := container.ToDisk(); err != nil { + logrus.Errorf("Error saving new container to disk: %v", err) return nil, nil, err } container.LogEvent("create") diff --git a/daemon/daemon.go b/daemon/daemon.go index 0a46ce2ae3..d413ce3324 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -219,7 +219,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err logrus.Debugf("unmount error %s", err) } if err := container.ToDisk(); err != nil { - logrus.Debugf("saving stopped state to disk %s", err) + logrus.Errorf("Error saving stopped state to disk: %v", err) } } @@ -235,7 +235,7 @@ func (daemon *Daemon) ensureName(container *Container) error { container.Name = name if err := container.ToDisk(); err != nil { - logrus.Debugf("Error saving container name %s", err) + logrus.Errorf("Error saving container name to disk: %v", err) } } return nil diff --git a/daemon/delete.go b/daemon/delete.go index 98dd1bba0c..9990019bf1 100644 --- a/daemon/delete.go +++ b/daemon/delete.go @@ -92,7 +92,9 @@ func (daemon *Daemon) rm(container *Container, forceRemove bool) (err error) { // Save container state to disk. So that if error happens before // container meta file got removed from disk, then a restart of // docker should not make a dead container alive. - container.ToDisk() + if err := container.ToDisk(); err != nil { + logrus.Errorf("Error saving dying container to disk: %v", err) + } // If force removal is required, delete container from various // indexes even if removal failed. diff --git a/daemon/monitor.go b/daemon/monitor.go index dfade8e218..ff173c8f03 100644 --- a/daemon/monitor.go +++ b/daemon/monitor.go @@ -263,7 +263,7 @@ func (m *containerMonitor) callback(processConfig *execdriver.ProcessConfig, pid } if err := m.container.ToDisk(); err != nil { - logrus.Debugf("%s", err) + logrus.Errorf("Error saving container to disk: %v", err) } }