Fixing servicing bug by always specifying LayerFolderPath
| ... | ... |
@@ -22,13 +22,22 @@ func (daemon *Daemon) postRunProcessing(container *container.Container, e libcon |
| 22 | 22 |
return err |
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 |
- servicingOption := &libcontainerd.ServicingOption{
|
|
| 25 |
+ newOpts := []libcontainerd.CreateOption{&libcontainerd.ServicingOption{
|
|
| 26 | 26 |
IsServicing: true, |
| 27 |
+ }} |
|
| 28 |
+ |
|
| 29 |
+ copts, err := daemon.getLibcontainerdCreateOptions(container) |
|
| 30 |
+ if err != nil {
|
|
| 31 |
+ return err |
|
| 32 |
+ } |
|
| 33 |
+ |
|
| 34 |
+ if copts != nil {
|
|
| 35 |
+ newOpts = append(newOpts, *copts...) |
|
| 27 | 36 |
} |
| 28 | 37 |
|
| 29 | 38 |
// Create a new servicing container, which will start, complete the update, and merge back the |
| 30 | 39 |
// results if it succeeded, all as part of the below function call. |
| 31 |
- if err := daemon.containerd.Create((container.ID + "_servicing"), "", "", *spec, servicingOption); err != nil {
|
|
| 40 |
+ if err := daemon.containerd.Create((container.ID + "_servicing"), "", "", *spec, newOpts...); err != nil {
|
|
| 32 | 41 |
container.SetExitCode(-1) |
| 33 | 42 |
return fmt.Errorf("Post-run update servicing failed: %s", err)
|
| 34 | 43 |
} |
| ... | ... |
@@ -30,10 +30,10 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain |
| 30 | 30 |
} |
| 31 | 31 |
if hvOpts.IsHyperV {
|
| 32 | 32 |
hvOpts.SandboxPath = filepath.Dir(m["dir"]) |
| 33 |
- } else {
|
|
| 34 |
- layerOpts.LayerFolderPath = m["dir"] |
|
| 35 | 33 |
} |
| 36 | 34 |
|
| 35 |
+ layerOpts.LayerFolderPath = m["dir"] |
|
| 36 |
+ |
|
| 37 | 37 |
// Generate the layer paths of the layer options |
| 38 | 38 |
img, err := daemon.imageStore.Get(container.ImageID) |
| 39 | 39 |
if err != nil {
|
| ... | ... |
@@ -40,15 +40,15 @@ const defaultOwner = "docker" |
| 40 | 40 |
// Create is the entrypoint to create a container from a spec, and if successfully |
| 41 | 41 |
// created, start it too. Table below shows the fields required for HCS JSON calling parameters, |
| 42 | 42 |
// where if not populated, is omitted. |
| 43 |
-// +-----------------+--------------------------------------------+--------------------------------------------+ |
|
| 44 |
-// | | Isolation=Process | Isolation=Hyper-V | |
|
| 45 |
-// +-----------------+--------------------------------------------+--------------------------------------------+ |
|
| 46 |
-// | VolumePath | \\?\\Volume{GUIDa} | |
|
|
| 47 |
-// | LayerFolderPath | %root%\windowsfilter\containerID | | |
|
| 48 |
-// | Layers[] | ID=GUIDb;Path=%root%\windowsfilter\layerID | ID=GUIDb;Path=%root%\windowsfilter\layerID | |
|
| 49 |
-// | SandboxPath | | %root%\windowsfilter | |
|
| 50 |
-// | HvRuntime | | ImagePath=%root%\BaseLayerID\UtilityVM | |
|
| 51 |
-// +-----------------+--------------------------------------------+--------------------------------------------+ |
|
| 43 |
+// +-----------------+--------------------------------------------+---------------------------------------------------+ |
|
| 44 |
+// | | Isolation=Process | Isolation=Hyper-V | |
|
| 45 |
+// +-----------------+--------------------------------------------+---------------------------------------------------+ |
|
| 46 |
+// | VolumePath | \\?\\Volume{GUIDa} | |
|
|
| 47 |
+// | LayerFolderPath | %root%\windowsfilter\containerID | %root%\windowsfilter\containerID (servicing only) | |
|
| 48 |
+// | Layers[] | ID=GUIDb;Path=%root%\windowsfilter\layerID | ID=GUIDb;Path=%root%\windowsfilter\layerID | |
|
| 49 |
+// | SandboxPath | | %root%\windowsfilter | |
|
| 50 |
+// | HvRuntime | | ImagePath=%root%\BaseLayerID\UtilityVM | |
|
| 51 |
+// +-----------------+--------------------------------------------+---------------------------------------------------+ |
|
| 52 | 52 |
// |
| 53 | 53 |
// Isolation=Process example: |
| 54 | 54 |
// |
| ... | ... |
@@ -183,9 +183,10 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir |
| 183 | 183 |
configuration.HvRuntime = &hcsshim.HvRuntime{ImagePath: uvmImagePath}
|
| 184 | 184 |
} else {
|
| 185 | 185 |
configuration.VolumePath = spec.Root.Path |
| 186 |
- configuration.LayerFolderPath = layerOpt.LayerFolderPath |
|
| 187 | 186 |
} |
| 188 | 187 |
|
| 188 |
+ configuration.LayerFolderPath = layerOpt.LayerFolderPath |
|
| 189 |
+ |
|
| 189 | 190 |
for _, layerPath := range layerOpt.LayerPaths {
|
| 190 | 191 |
_, filename := filepath.Split(layerPath) |
| 191 | 192 |
g, err := hcsshim.NameToGuid(filename) |