daemon: don't prepare mountpoint for restart container

The restart container has already prepared the mountpoint, there is
no need to do that again. This can speed up the daemon start if
the restart container has a volume and the volume driver is not
available.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 0feeab2e43a75bee3d5709248544b3078df96706
Component: engine
This commit is contained in:
Lei Jitang
2016-01-27 02:43:40 -05:00
parent ee42d601b2
commit 2fd968f843
+7
View File
@@ -376,6 +376,13 @@ func (daemon *Daemon) restore() error {
// This must be run after any containers with a restart policy so that containerized plugins
// can have a chance to be running before we try to initialize them.
for _, c := range containers {
// if the container has restart policy, do not
// prepare the mountpoints since it has been done on restarting.
// This is to speed up the daemon start when a restart container
// has a volume and the volume dirver is not available.
if _, ok := restartContainers[c]; ok {
continue
}
group.Add(1)
go func(c *container.Container) {
defer group.Done()