Merge pull request #27038 from jstarks/non_base_utilityvm

Windows: support Windows servicing layers
Upstream-commit: 214b70e6ef9c5430c48cd88303f4cc0574e0037a
Component: engine
This commit is contained in:
Michael Crosby
2016-10-05 10:02:31 -07:00
committed by GitHub
5 changed files with 390 additions and 63 deletions

View File

@ -162,12 +162,25 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
}
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.
configuration.HvRuntime = &hcsshim.HvRuntime{ImagePath: filepath.Join(layerOpt.LayerPaths[len(layerOpt.LayerPaths)-1], "UtilityVM")}
if _, err := os.Stat(configuration.HvRuntime.ImagePath); os.IsNotExist(err) {
return fmt.Errorf("utility VM image '%s' could not be found", configuration.HvRuntime.ImagePath)
var uvmImagePath string
for _, path := range layerOpt.LayerPaths {
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 {
configuration.VolumePath = spec.Root.Path
configuration.LayerFolderPath = layerOpt.LayerFolderPath