瀏覽代碼

Move plugin shutdown after layerstore shtudown

This ensures that graphdriver plugins can properly cleanup on daemon
exit.
Also prevents errors during shutdown when it tries to send the plugin a
`Cleanup()` request but ultimately times out since it's already been
shutdown.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 4b400ecc4df4bcf245f1f751a7fd0c9c193d9dbf)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Brian Goff 8 年之前
父節點
當前提交
bb55c05ec1
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      daemon/daemon.go

+ 7 - 7
daemon/daemon.go

@@ -796,7 +796,13 @@ func (daemon *Daemon) Shutdown() error {
 		})
 	}
 
-	// Shutdown plugins after containers. Don't change the order.
+	if daemon.layerStore != nil {
+		if err := daemon.layerStore.Cleanup(); err != nil {
+			logrus.Errorf("Error during layer Store.Cleanup(): %v", err)
+		}
+	}
+
+	// Shutdown plugins after containers and layerstore. Don't change the order.
 	daemon.pluginShutdown()
 
 	// trigger libnetwork Stop only if it's initialized
@@ -804,12 +810,6 @@ func (daemon *Daemon) Shutdown() error {
 		daemon.netController.Stop()
 	}
 
-	if daemon.layerStore != nil {
-		if err := daemon.layerStore.Cleanup(); err != nil {
-			logrus.Errorf("Error during layer Store.Cleanup(): %v", err)
-		}
-	}
-
 	if err := daemon.cleanupMounts(); err != nil {
 		return err
 	}