Ver Fonte

Merge pull request #27149 from swernli/servicing_fix

Fixing servicing bug by always specifying LayerFolderPath
Alexander Morozov há 8 anos atrás
pai
commit
33ae7d4c19
3 ficheiros alterados com 24 adições e 14 exclusões
  1. 11 2
      daemon/monitor_windows.go
  2. 2 2
      daemon/start_windows.go
  3. 11 10
      libcontainerd/client_windows.go

+ 11 - 2
daemon/monitor_windows.go

@@ -22,13 +22,22 @@ func (daemon *Daemon) postRunProcessing(container *container.Container, e libcon
 			return err
 			return err
 		}
 		}
 
 
-		servicingOption := &libcontainerd.ServicingOption{
+		newOpts := []libcontainerd.CreateOption{&libcontainerd.ServicingOption{
 			IsServicing: true,
 			IsServicing: true,
+		}}
+
+		copts, err := daemon.getLibcontainerdCreateOptions(container)
+		if err != nil {
+			return err
+		}
+
+		if copts != nil {
+			newOpts = append(newOpts, *copts...)
 		}
 		}
 
 
 		// Create a new servicing container, which will start, complete the update, and merge back the
 		// Create a new servicing container, which will start, complete the update, and merge back the
 		// results if it succeeded, all as part of the below function call.
 		// results if it succeeded, all as part of the below function call.
-		if err := daemon.containerd.Create((container.ID + "_servicing"), "", "", *spec, servicingOption); err != nil {
+		if err := daemon.containerd.Create((container.ID + "_servicing"), "", "", *spec, newOpts...); err != nil {
 			container.SetExitCode(-1)
 			container.SetExitCode(-1)
 			return fmt.Errorf("Post-run update servicing failed: %s", err)
 			return fmt.Errorf("Post-run update servicing failed: %s", err)
 		}
 		}

+ 2 - 2
daemon/start_windows.go

@@ -30,10 +30,10 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain
 	}
 	}
 	if hvOpts.IsHyperV {
 	if hvOpts.IsHyperV {
 		hvOpts.SandboxPath = filepath.Dir(m["dir"])
 		hvOpts.SandboxPath = filepath.Dir(m["dir"])
-	} else {
-		layerOpts.LayerFolderPath = m["dir"]
 	}
 	}
 
 
+	layerOpts.LayerFolderPath = m["dir"]
+
 	// Generate the layer paths of the layer options
 	// Generate the layer paths of the layer options
 	img, err := daemon.imageStore.Get(container.ImageID)
 	img, err := daemon.imageStore.Get(container.ImageID)
 	if err != nil {
 	if err != nil {

+ 11 - 10
libcontainerd/client_windows.go

@@ -40,15 +40,15 @@ const defaultOwner = "docker"
 // Create is the entrypoint to create a container from a spec, and if successfully
 // Create is the entrypoint to create a container from a spec, and if successfully
 // created, start it too. Table below shows the fields required for HCS JSON calling parameters,
 // created, start it too. Table below shows the fields required for HCS JSON calling parameters,
 // where if not populated, is omitted.
 // where if not populated, is omitted.
-// +-----------------+--------------------------------------------+--------------------------------------------+
-// |                 | Isolation=Process                          | Isolation=Hyper-V                          |
-// +-----------------+--------------------------------------------+--------------------------------------------+
-// | VolumePath      | \\?\\Volume{GUIDa}                         |                                            |
-// | LayerFolderPath | %root%\windowsfilter\containerID           |                                            |
-// | Layers[]        | ID=GUIDb;Path=%root%\windowsfilter\layerID | ID=GUIDb;Path=%root%\windowsfilter\layerID |
-// | SandboxPath     |                                            | %root%\windowsfilter                       |
-// | HvRuntime       |                                            | ImagePath=%root%\BaseLayerID\UtilityVM     |
-// +-----------------+--------------------------------------------+--------------------------------------------+
+// +-----------------+--------------------------------------------+---------------------------------------------------+
+// |                 | Isolation=Process                          | Isolation=Hyper-V                                 |
+// +-----------------+--------------------------------------------+---------------------------------------------------+
+// | VolumePath      | \\?\\Volume{GUIDa}                         |                                                   |
+// | LayerFolderPath | %root%\windowsfilter\containerID           | %root%\windowsfilter\containerID (servicing only) |
+// | Layers[]        | ID=GUIDb;Path=%root%\windowsfilter\layerID | ID=GUIDb;Path=%root%\windowsfilter\layerID        |
+// | SandboxPath     |                                            | %root%\windowsfilter                              |
+// | HvRuntime       |                                            | ImagePath=%root%\BaseLayerID\UtilityVM            |
+// +-----------------+--------------------------------------------+---------------------------------------------------+
 //
 //
 // Isolation=Process example:
 // Isolation=Process example:
 //
 //
@@ -183,9 +183,10 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
 		configuration.HvRuntime = &hcsshim.HvRuntime{ImagePath: uvmImagePath}
 		configuration.HvRuntime = &hcsshim.HvRuntime{ImagePath: uvmImagePath}
 	} else {
 	} else {
 		configuration.VolumePath = spec.Root.Path
 		configuration.VolumePath = spec.Root.Path
-		configuration.LayerFolderPath = layerOpt.LayerFolderPath
 	}
 	}
 
 
+	configuration.LayerFolderPath = layerOpt.LayerFolderPath
+
 	for _, layerPath := range layerOpt.LayerPaths {
 	for _, layerPath := range layerOpt.LayerPaths {
 		_, filename := filepath.Split(layerPath)
 		_, filename := filepath.Split(layerPath)
 		g, err := hcsshim.NameToGuid(filename)
 		g, err := hcsshim.NameToGuid(filename)