Add a Windows section for Linux oci on LCOW

When creating a default OCI spec on Windows that is targeting the LCOW
platform it needs to contain a Windows section as well. This adds the
Windows section by default. It also protects against this case for all
OCI creation that doesnt use the OCI package in the runhcs-shim.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
This commit is contained in:
Justin Terry (VM)
2018-09-06 11:05:45 -07:00
parent 96986c04db
commit ef910311e8
4 changed files with 68 additions and 25 deletions

View File

@@ -314,6 +314,14 @@ func writeMountsToConfig(bundle string, mounts []*containerd_types.Mount) error
return errors.Wrap(err, "failed to seek to 0 in config.json")
}
// If we are creating LCOW make sure that spec.Windows is filled out before
// appending layer folders.
if m.Type == "lcow-layer" && spec.Windows == nil {
spec.Windows = &oci.Windows{
HyperV: &oci.WindowsHyperV{},
}
}
// Append the parents
spec.Windows.LayerFolders = append(spec.Windows.LayerFolders, parentLayerPaths...)
// Append the scratch