Browse code

Merge pull request #50869 from vvoland/c8d-fix-windows-migration

daemon: Fix unwanted c8d migration on Windows

Paweł Gronowski authored on 2025/09/25 20:13:39
Showing 2 changed files
... ...
@@ -785,6 +785,10 @@ func (daemon *Daemon) IsSwarmCompatible() error {
785 785
 	return daemon.config().IsSwarmCompatible()
786 786
 }
787 787
 
788
+func useContainerdByDefault() bool {
789
+	return os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == "" && runtime.GOOS != "windows"
790
+}
791
+
788 792
 // NewDaemon sets up everything for the daemon to be able to service
789 793
 // requests from the webserver.
790 794
 func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.Store, authzMiddleware *authorization.Middleware) (_ *Daemon, retErr error) {
... ...
@@ -894,7 +898,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
894 894
 			log.G(ctx).WithField("env", os.Environ()).Info("Migration to containerd is enabled, driver will be switched to snapshotter if there are no images or containers")
895 895
 		}
896 896
 	}
897
-	if config.Features["containerd-snapshotter"] {
897
+	if config.Features["containerd-snapshotter"] && useContainerdByDefault() {
898 898
 		log.G(ctx).Warn(`"containerd-snapshotter" is now the default and no longer needed to be set`)
899 899
 	}
900 900
 
... ...
@@ -1113,11 +1117,10 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
1113 1113
 		case "windowsfilter":
1114 1114
 			// Docker WCOW graphdriver
1115 1115
 		case "":
1116
-			// Use graph driver but enable migration
1116
+			// Use graph driver unless opted-in to containerd store
1117 1117
 			driverName = "windowsfilter"
1118
-			if os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == "" {
1119
-				// Don't force migration if graph driver is explicit
1120
-				migrationThreshold = 0
1118
+			if useContainerdByDefault() || config.Features["containerd-snapshotter"] {
1119
+				driverName = "windows"
1121 1120
 			}
1122 1121
 		default:
1123 1122
 			log.G(ctx).Infof("Using non-default snapshotter %s", driverName)
... ...
@@ -5,6 +5,7 @@ import (
5 5
 	"fmt"
6 6
 	"os"
7 7
 	"path/filepath"
8
+	"runtime"
8 9
 	"strings"
9 10
 	"testing"
10 11
 
... ...
@@ -190,7 +191,7 @@ func (e *Execution) IsUserNamespaceInKernel() bool {
190 190
 // UsingSnapshotter returns whether containerd snapshotters are used for the
191 191
 // tests by checking if the "TEST_INTEGRATION_USE_GRAPHDRIVER" is empty
192 192
 func (e *Execution) UsingSnapshotter() bool {
193
-	return os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == ""
193
+	return os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == "" && runtime.GOOS != "windows"
194 194
 }
195 195
 
196 196
 // HasExistingImage checks whether there is an image with the given reference.