Browse code

Allow containers to continue even if mount failed after live restore

This fix is a follow up to #29365. In #29365 a bug was fixed for
`docker exec -u user` after live restore by remounting.
However, #29365 will prevent containers from restored if mount failed.

In this fix, containers will be restored even if mount in that step failed.
Some functionalities might be missing (like `docker exec -u user`) but
at least it is possible to do certain operations like stop/restart/delete.

This fix is related to #29365.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
(cherry picked from commit 3003ae1d8bd112e78bcc8c1c70efd9d3ef6f0ddc)

Yong Tang authored on 2016/12/16 06:26:27
Showing 1 changed files
... ...
@@ -148,8 +148,13 @@ func (daemon *Daemon) restore() error {
148 148
 			}
149 149
 			container.RWLayer = rwlayer
150 150
 			if err := daemon.Mount(container); err != nil {
151
-				logrus.Errorf("Failed to mount container %v: %v", id, err)
152
-				continue
151
+				// The mount is unlikely to fail. However, in case mount fails
152
+				// the container should be allowed to restore here. Some functionalities
153
+				// (like docker exec -u user) might be missing but container is able to be
154
+				// stopped/restarted/removed.
155
+				// See #29365 for related information.
156
+				// The error is only logged here.
157
+				logrus.Warnf("Failed to mount container %v: %v", id, err)
153 158
 			}
154 159
 			logrus.Debugf("Loaded container %v", container.ID)
155 160