Windows: Use the top-most utility VM image
Microsoft will be distributing non-base layers that have utility VM image updates. Update libcontainerd to use the top-most utility VM image that is available in the image chain when launching Hyper-V-isolated container. Signed-off-by: John Starks <jostarks@microsoft.com>
This commit is contained in:
parent
6f07a4a69b
commit
2a765279fa
1 changed files with 17 additions and 4 deletions
|
@ -161,12 +161,25 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
|
||||||
}
|
}
|
||||||
|
|
||||||
if configuration.HvPartition {
|
if configuration.HvPartition {
|
||||||
// Make sure the Utility VM image is present in the base layer directory.
|
// Find the upper-most utility VM image, since the utility VM does not
|
||||||
|
// use layering in RS1.
|
||||||
// TODO @swernli/jhowardmsft at some point post RS1 this may be re-locatable.
|
// TODO @swernli/jhowardmsft at some point post RS1 this may be re-locatable.
|
||||||
configuration.HvRuntime = &hcsshim.HvRuntime{ImagePath: filepath.Join(layerOpt.LayerPaths[len(layerOpt.LayerPaths)-1], "UtilityVM")}
|
var uvmImagePath string
|
||||||
if _, err := os.Stat(configuration.HvRuntime.ImagePath); os.IsNotExist(err) {
|
for _, path := range layerOpt.LayerPaths {
|
||||||
return fmt.Errorf("utility VM image '%s' could not be found", configuration.HvRuntime.ImagePath)
|
fullPath := filepath.Join(path, "UtilityVM")
|
||||||
|
_, err := os.Stat(fullPath)
|
||||||
|
if err == nil {
|
||||||
|
uvmImagePath = fullPath
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if !os.IsNotExist(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if uvmImagePath == "" {
|
||||||
|
return errors.New("utility VM image could not be found")
|
||||||
|
}
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in a new issue