1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/libcontainerd/utils_windows.go
John Starks 8e34322253 Windows: Disable VM cloning for TP5 image
The Windows TP5 image is not compatible with the Hyper-V isolated
container clone feature. Detect old images and pass a flag specifying that
clone should not be enabled.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-06-24 16:12:44 -07:00

37 lines
867 B
Go

package libcontainerd
import (
"strconv"
"strings"
)
// setupEnvironmentVariables convert a string array of environment variables
// into a map as required by the HCS. Source array is in format [v1=k1] [v2=k2] etc.
func setupEnvironmentVariables(a []string) map[string]string {
r := make(map[string]string)
for _, s := range a {
arr := strings.Split(s, "=")
if len(arr) == 2 {
r[arr[0]] = arr[1]
}
}
return r
}
// Apply for a servicing option is a no-op.
func (s *ServicingOption) Apply(interface{}) error {
return nil
}
// buildFromVersion takes an image version string and returns the Windows build
// number. It returns 0 if the build number is not present.
func buildFromVersion(osver string) int {
v := strings.Split(osver, ".")
if len(v) < 3 {
return 0
}
if build, err := strconv.Atoi(v[2]); err == nil {
return build
}
return 0
}