Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
"time" |
| 13 | 13 |
"unsafe" |
| 14 | 14 |
|
| 15 |
- "github.com/docker/docker/pkg/system" |
|
| 15 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 16 | 16 |
"github.com/sirupsen/logrus" |
| 17 | 17 |
"github.com/spf13/pflag" |
| 18 | 18 |
"golang.org/x/sys/windows" |
| ... | ... |
@@ -171,7 +171,7 @@ func registerService() error {
|
| 171 | 171 |
|
| 172 | 172 |
// This dependency is required on build 14393 (RS1) |
| 173 | 173 |
// it is added to the platform in newer builds |
| 174 |
- if system.GetOSVersion().Build == 14393 {
|
|
| 174 |
+ if osversion.Build() == osversion.RS1 {
|
|
| 175 | 175 |
depends = append(depends, "ConDrv") |
| 176 | 176 |
} |
| 177 | 177 |
|
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
"strings" |
| 8 | 8 |
|
| 9 | 9 |
"github.com/Microsoft/hcsshim" |
| 10 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 10 | 11 |
"github.com/docker/docker/api/types" |
| 11 | 12 |
containertypes "github.com/docker/docker/api/types/container" |
| 12 | 13 |
"github.com/docker/docker/container" |
| ... | ... |
@@ -126,8 +127,7 @@ func verifyPlatformContainerResources(resources *containertypes.Resources, isHyp |
| 126 | 126 |
return warnings, fmt.Errorf("range of CPUs is from 0.01 to %d.00, as there are only %d CPUs available", sysinfo.NumCPU(), sysinfo.NumCPU())
|
| 127 | 127 |
} |
| 128 | 128 |
|
| 129 |
- osv := system.GetOSVersion() |
|
| 130 |
- if resources.NanoCPUs > 0 && isHyperv && osv.Build < 16175 {
|
|
| 129 |
+ if resources.NanoCPUs > 0 && isHyperv && osversion.Build() < osversion.RS3 {
|
|
| 131 | 130 |
leftoverNanoCPUs := resources.NanoCPUs % 1e9 |
| 132 | 131 |
if leftoverNanoCPUs != 0 && resources.NanoCPUs > 1e9 {
|
| 133 | 132 |
resources.NanoCPUs = ((resources.NanoCPUs + 1e9/2) / 1e9) * 1e9 |
| ... | ... |
@@ -196,14 +196,13 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes. |
| 196 | 196 |
if hostConfig == nil {
|
| 197 | 197 |
return nil, nil |
| 198 | 198 |
} |
| 199 |
- osv := system.GetOSVersion() |
|
| 200 | 199 |
hyperv := daemon.runAsHyperVContainer(hostConfig) |
| 201 | 200 |
|
| 202 | 201 |
// On RS5, we allow (but don't strictly support) process isolation on Client SKUs. |
| 203 | 202 |
// Prior to RS5, we don't allow process isolation on Client SKUs. |
| 204 | 203 |
// @engine maintainers. This block should not be removed. It partially enforces licensing |
| 205 | 204 |
// restrictions on Windows. Ping Microsoft folks if there are concerns or PRs to change this. |
| 206 |
- if !hyperv && system.IsWindowsClient() && osv.Build < 17763 {
|
|
| 205 |
+ if !hyperv && system.IsWindowsClient() && osversion.Build() < osversion.RS5 {
|
|
| 207 | 206 |
return warnings, fmt.Errorf("Windows client operating systems earlier than version 1809 can only run Hyper-V containers")
|
| 208 | 207 |
} |
| 209 | 208 |
|
| ... | ... |
@@ -225,7 +224,7 @@ func checkSystem() error {
|
| 225 | 225 |
if osv.MajorVersion < 10 {
|
| 226 | 226 |
return fmt.Errorf("This version of Windows does not support the docker daemon")
|
| 227 | 227 |
} |
| 228 |
- if osv.Build < 14393 {
|
|
| 228 |
+ if osversion.Build() < osversion.RS1 {
|
|
| 229 | 229 |
return fmt.Errorf("The docker daemon requires build 14393 or later of Windows Server 2016 or Windows 10")
|
| 230 | 230 |
} |
| 231 | 231 |
|
| ... | ... |
@@ -425,26 +424,15 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *config.Co |
| 425 | 425 |
winlibnetwork.NetworkName: runconfig.DefaultDaemonNetworkMode().NetworkName(), |
| 426 | 426 |
} |
| 427 | 427 |
|
| 428 |
- var ipamOption libnetwork.NetworkOption |
|
| 429 |
- var subnetPrefix string |
|
| 430 |
- |
|
| 428 |
+ subnetPrefix := defaultNetworkSpace |
|
| 431 | 429 |
if config.BridgeConfig.FixedCIDR != "" {
|
| 432 | 430 |
subnetPrefix = config.BridgeConfig.FixedCIDR |
| 433 |
- } else {
|
|
| 434 |
- // TP5 doesn't support properly detecting subnet |
|
| 435 |
- osv := system.GetOSVersion() |
|
| 436 |
- if osv.Build < 14360 {
|
|
| 437 |
- subnetPrefix = defaultNetworkSpace |
|
| 438 |
- } |
|
| 439 | 431 |
} |
| 440 | 432 |
|
| 441 |
- if subnetPrefix != "" {
|
|
| 442 |
- ipamV4Conf := libnetwork.IpamConf{}
|
|
| 443 |
- ipamV4Conf.PreferredPool = subnetPrefix |
|
| 444 |
- v4Conf := []*libnetwork.IpamConf{&ipamV4Conf}
|
|
| 445 |
- v6Conf := []*libnetwork.IpamConf{}
|
|
| 446 |
- ipamOption = libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil)
|
|
| 447 |
- } |
|
| 433 |
+ ipamV4Conf := libnetwork.IpamConf{PreferredPool: subnetPrefix}
|
|
| 434 |
+ v4Conf := []*libnetwork.IpamConf{&ipamV4Conf}
|
|
| 435 |
+ v6Conf := []*libnetwork.IpamConf{}
|
|
| 436 |
+ ipamOption := libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil)
|
|
| 448 | 437 |
|
| 449 | 438 |
_, err := controller.NewNetwork(string(runconfig.DefaultDaemonNetworkMode()), runconfig.DefaultDaemonNetworkMode().NetworkName(), "", |
| 450 | 439 |
libnetwork.NetworkOptionGeneric(options.Generic{
|
| ... | ... |
@@ -602,7 +590,6 @@ func (daemon *Daemon) stats(c *container.Container) (*types.StatsJSON, error) {
|
| 602 | 602 |
// daemon to run in. This is only applicable on Windows |
| 603 | 603 |
func (daemon *Daemon) setDefaultIsolation() error {
|
| 604 | 604 |
daemon.defaultIsolation = containertypes.Isolation("process")
|
| 605 |
- osv := system.GetOSVersion() |
|
| 606 | 605 |
|
| 607 | 606 |
// On client SKUs, default to Hyper-V. @engine maintainers. This |
| 608 | 607 |
// should not be removed. Ping Microsoft folks is there are PRs to |
| ... | ... |
@@ -626,7 +613,7 @@ func (daemon *Daemon) setDefaultIsolation() error {
|
| 626 | 626 |
daemon.defaultIsolation = containertypes.Isolation("hyperv")
|
| 627 | 627 |
} |
| 628 | 628 |
if containertypes.Isolation(val).IsProcess() {
|
| 629 |
- if system.IsWindowsClient() && osv.Build < 17763 {
|
|
| 629 |
+ if system.IsWindowsClient() && osversion.Build() < osversion.RS5 {
|
|
| 630 | 630 |
// On RS5, we allow (but don't strictly support) process isolation on Client SKUs. |
| 631 | 631 |
// @engine maintainers. This block should not be removed. It partially enforces licensing |
| 632 | 632 |
// restrictions on Windows. Ping Microsoft folks if there are concerns or PRs to change this. |
| ... | ... |
@@ -24,6 +24,7 @@ import ( |
| 24 | 24 |
"github.com/Microsoft/go-winio/backuptar" |
| 25 | 25 |
"github.com/Microsoft/go-winio/vhd" |
| 26 | 26 |
"github.com/Microsoft/hcsshim" |
| 27 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 27 | 28 |
"github.com/docker/docker/daemon/graphdriver" |
| 28 | 29 |
"github.com/docker/docker/pkg/archive" |
| 29 | 30 |
"github.com/docker/docker/pkg/containerfs" |
| ... | ... |
@@ -31,7 +32,6 @@ import ( |
| 31 | 31 |
"github.com/docker/docker/pkg/ioutils" |
| 32 | 32 |
"github.com/docker/docker/pkg/longpath" |
| 33 | 33 |
"github.com/docker/docker/pkg/reexec" |
| 34 |
- "github.com/docker/docker/pkg/system" |
|
| 35 | 34 |
units "github.com/docker/go-units" |
| 36 | 35 |
"github.com/pkg/errors" |
| 37 | 36 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -272,7 +272,6 @@ func (d *Driver) Remove(id string) error {
|
| 272 | 272 |
// it is a transient error. Retry until it succeeds. |
| 273 | 273 |
var computeSystems []hcsshim.ContainerProperties |
| 274 | 274 |
retryCount := 0 |
| 275 |
- osv := system.GetOSVersion() |
|
| 276 | 275 |
for {
|
| 277 | 276 |
// Get and terminate any template VMs that are currently using the layer. |
| 278 | 277 |
// Note: It is unfortunate that we end up in the graphdrivers Remove() call |
| ... | ... |
@@ -294,8 +293,10 @@ func (d *Driver) Remove(id string) error {
|
| 294 | 294 |
// not required. |
| 295 | 295 |
computeSystems, err = hcsshim.GetContainers(hcsshim.ComputeSystemQuery{})
|
| 296 | 296 |
if err != nil {
|
| 297 |
- if (osv.Build < 15139) && |
|
| 298 |
- ((err == hcsshim.ErrVmcomputeOperationInvalidState) || (err == hcsshim.ErrVmcomputeOperationAccessIsDenied)) {
|
|
| 297 |
+ if osversion.Build() >= osversion.RS3 {
|
|
| 298 |
+ return err |
|
| 299 |
+ } |
|
| 300 |
+ if (err == hcsshim.ErrVmcomputeOperationInvalidState) || (err == hcsshim.ErrVmcomputeOperationAccessIsDenied) {
|
|
| 299 | 301 |
if retryCount >= 500 {
|
| 300 | 302 |
break |
| 301 | 303 |
} |
| ... | ... |
@@ -8,6 +8,7 @@ import ( |
| 8 | 8 |
"runtime" |
| 9 | 9 |
"strings" |
| 10 | 10 |
|
| 11 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 11 | 12 |
containertypes "github.com/docker/docker/api/types/container" |
| 12 | 13 |
"github.com/docker/docker/container" |
| 13 | 14 |
"github.com/docker/docker/errdefs" |
| ... | ... |
@@ -275,7 +276,7 @@ func (daemon *Daemon) createSpecWindowsFields(c *container.Container, s *specs.S |
| 275 | 275 |
if isHyperV {
|
| 276 | 276 |
return errors.New("device assignment is not supported for HyperV containers")
|
| 277 | 277 |
} |
| 278 |
- if system.GetOSVersion().Build < 17763 {
|
|
| 278 |
+ if osversion.Build() < osversion.RS5 {
|
|
| 279 | 279 |
return errors.New("device assignment requires Windows builds RS5 (17763+) or later")
|
| 280 | 280 |
} |
| 281 | 281 |
for _, deviceMapping := range c.HostConfig.Devices {
|
| ... | ... |
@@ -11,6 +11,7 @@ import ( |
| 11 | 11 |
"strconv" |
| 12 | 12 |
"strings" |
| 13 | 13 |
|
| 14 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 14 | 15 |
"github.com/containerd/containerd/platforms" |
| 15 | 16 |
"github.com/docker/distribution" |
| 16 | 17 |
"github.com/docker/distribution/manifest/manifestlist" |
| ... | ... |
@@ -65,7 +66,7 @@ func (ld *v2LayerDescriptor) open(ctx context.Context) (distribution.ReadSeekClo |
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
func filterManifests(manifests []manifestlist.ManifestDescriptor, p specs.Platform) []manifestlist.ManifestDescriptor {
|
| 68 |
- version := system.GetOSVersion() |
|
| 68 |
+ version := osversion.Get() |
|
| 69 | 69 |
osVersion := fmt.Sprintf("%d.%d.%d", version.MajorVersion, version.MinorVersion, version.Build)
|
| 70 | 70 |
logrus.Debugf("will prefer Windows entries with version %s", osVersion)
|
| 71 | 71 |
|
| ... | ... |
@@ -123,7 +124,7 @@ func (mbv manifestsByVersion) Swap(i, j int) {
|
| 123 | 123 |
// Fixes https://github.com/moby/moby/issues/36184. |
| 124 | 124 |
func checkImageCompatibility(imageOS, imageOSVersion string) error {
|
| 125 | 125 |
if imageOS == "windows" {
|
| 126 |
- hostOSV := system.GetOSVersion() |
|
| 126 |
+ hostOSV := osversion.Get() |
|
| 127 | 127 |
splitImageOSVersion := strings.Split(imageOSVersion, ".") // eg 10.0.16299.nnnn |
| 128 | 128 |
if len(splitImageOSVersion) >= 3 {
|
| 129 | 129 |
if imageOSBuild, err := strconv.Atoi(splitImageOSVersion[2]); err == nil {
|
| ... | ... |
@@ -142,5 +143,5 @@ func formatPlatform(platform specs.Platform) string {
|
| 142 | 142 |
if platform.OS == "" {
|
| 143 | 143 |
platform = platforms.DefaultSpec() |
| 144 | 144 |
} |
| 145 |
- return fmt.Sprintf("%s %s", platforms.Format(platform), system.GetOSVersion().ToString())
|
|
| 145 |
+ return fmt.Sprintf("%s %s", platforms.Format(platform), osversion.Get().ToString())
|
|
| 146 | 146 |
} |
| ... | ... |
@@ -11,6 +11,7 @@ import ( |
| 11 | 11 |
"testing" |
| 12 | 12 |
|
| 13 | 13 |
winio "github.com/Microsoft/go-winio" |
| 14 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 14 | 15 |
"github.com/docker/docker/api/types" |
| 15 | 16 |
"github.com/docker/docker/api/types/container" |
| 16 | 17 |
"github.com/docker/docker/api/types/mount" |
| ... | ... |
@@ -19,7 +20,7 @@ import ( |
| 19 | 19 |
) |
| 20 | 20 |
|
| 21 | 21 |
func (s *DockerSuite) TestContainersAPICreateMountsBindNamedPipe(c *testing.T) {
|
| 22 |
- testRequires(c, testEnv.IsLocalDaemon, DaemonIsWindowsAtLeastBuild(16299)) // Named pipe support was added in RS3 |
|
| 22 |
+ testRequires(c, testEnv.IsLocalDaemon, DaemonIsWindowsAtLeastBuild(osversion.RS3)) // Named pipe support was added in RS3 |
|
| 23 | 23 |
|
| 24 | 24 |
// Create a host pipe to map into the container |
| 25 | 25 |
hostPipeName := fmt.Sprintf(`\\.\pipe\docker-cli-test-pipe-%x`, rand.Uint64()) |
| ... | ... |
@@ -9,6 +9,7 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 12 | 13 |
"github.com/docker/docker/api/types" |
| 13 | 14 |
"github.com/docker/docker/api/types/filters" |
| 14 | 15 |
"github.com/docker/docker/client" |
| ... | ... |
@@ -59,10 +60,12 @@ func (s *DockerSuite) TestAPIImagesFilter(c *testing.T) {
|
| 59 | 59 |
|
| 60 | 60 |
func (s *DockerSuite) TestAPIImagesSaveAndLoad(c *testing.T) {
|
| 61 | 61 |
if runtime.GOOS == "windows" {
|
| 62 |
+ // Note we parse kernel.GetKernelVersion rather than osversion.Build() |
|
| 63 |
+ // as test binaries aren't manifested, so would otherwise report build 9200. |
|
| 62 | 64 |
v, err := kernel.GetKernelVersion() |
| 63 | 65 |
assert.NilError(c, err) |
| 64 |
- build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0]) |
|
| 65 |
- if build <= 16299 {
|
|
| 66 |
+ buildNumber, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0]) |
|
| 67 |
+ if buildNumber <= osversion.RS3 {
|
|
| 66 | 68 |
c.Skip("Temporarily disabled on RS3 and older because they are too slow. See #39909")
|
| 67 | 69 |
} |
| 68 | 70 |
} |
| ... | ... |
@@ -139,10 +142,12 @@ func (s *DockerSuite) TestAPIImagesHistory(c *testing.T) {
|
| 139 | 139 |
|
| 140 | 140 |
func (s *DockerSuite) TestAPIImagesImportBadSrc(c *testing.T) {
|
| 141 | 141 |
if runtime.GOOS == "windows" {
|
| 142 |
+ // Note we parse kernel.GetKernelVersion rather than osversion.Build() |
|
| 143 |
+ // as test binaries aren't manifested, so would otherwise report build 9200. |
|
| 142 | 144 |
v, err := kernel.GetKernelVersion() |
| 143 | 145 |
assert.NilError(c, err) |
| 144 |
- build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0]) |
|
| 145 |
- if build == 16299 {
|
|
| 146 |
+ buildNumber, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0]) |
|
| 147 |
+ if buildNumber == osversion.RS3 {
|
|
| 146 | 148 |
c.Skip("Temporarily disabled on RS3 builds")
|
| 147 | 149 |
} |
| 148 | 150 |
} |
| ... | ... |
@@ -23,6 +23,7 @@ import ( |
| 23 | 23 |
"testing" |
| 24 | 24 |
"time" |
| 25 | 25 |
|
| 26 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 26 | 27 |
"github.com/docker/docker/client" |
| 27 | 28 |
"github.com/docker/docker/integration-cli/cli" |
| 28 | 29 |
"github.com/docker/docker/integration-cli/cli/build" |
| ... | ... |
@@ -1880,7 +1881,7 @@ func (s *DockerSuite) TestRunBindMounts(c *testing.T) {
|
| 1880 | 1880 |
|
| 1881 | 1881 |
if testEnv.OSType == "windows" {
|
| 1882 | 1882 |
// Disabled prior to RS5 due to how volumes are mapped |
| 1883 |
- testRequires(c, DaemonIsWindowsAtLeastBuild(17763)) |
|
| 1883 |
+ testRequires(c, DaemonIsWindowsAtLeastBuild(osversion.RS5)) |
|
| 1884 | 1884 |
} |
| 1885 | 1885 |
|
| 1886 | 1886 |
prefix, _ := getPrefixAndSlashFromDaemonPlatform() |
| ... | ... |
@@ -3915,16 +3916,16 @@ func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *testing.T) {
|
| 3915 | 3915 |
} |
| 3916 | 3916 |
|
| 3917 | 3917 |
func (s *DockerSuite) TestRunAttachFailedNoLeak(c *testing.T) {
|
| 3918 |
- // TODO @msabansal - https://github.com/moby/moby/issues/35023. Duplicate |
|
| 3919 |
- // port mappings are not errored out on RS3 builds. Temporarily disabling |
|
| 3920 |
- // this test pending further investigation. Note we parse kernel.GetKernelVersion |
|
| 3921 |
- // rather than system.GetOSVersion as test binaries aren't manifested, so would |
|
| 3922 |
- // otherwise report build 9200. |
|
| 3923 | 3918 |
if runtime.GOOS == "windows" {
|
| 3919 |
+ // TODO @msabansal - https://github.com/moby/moby/issues/35023. Duplicate |
|
| 3920 |
+ // port mappings are not errored out on RS3 builds. Temporarily disabling |
|
| 3921 |
+ // this test pending further investigation. Note we parse kernel.GetKernelVersion |
|
| 3922 |
+ // rather than osversion.Build() as test binaries aren't manifested, so would |
|
| 3923 |
+ // otherwise report build 9200. |
|
| 3924 | 3924 |
v, err := kernel.GetKernelVersion() |
| 3925 | 3925 |
assert.NilError(c, err) |
| 3926 |
- build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0]) |
|
| 3927 |
- if build == 16299 {
|
|
| 3926 |
+ buildNumber, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0]) |
|
| 3927 |
+ if buildNumber == osversion.RS3 {
|
|
| 3928 | 3928 |
c.Skip("Temporarily disabled on RS3 builds")
|
| 3929 | 3929 |
} |
| 3930 | 3930 |
} |
| ... | ... |
@@ -4532,7 +4533,7 @@ func (s *DockerSuite) TestRunAddDeviceCgroupRule(c *testing.T) {
|
| 4532 | 4532 |
|
| 4533 | 4533 |
// Verifies that running as local system is operating correctly on Windows |
| 4534 | 4534 |
func (s *DockerSuite) TestWindowsRunAsSystem(c *testing.T) {
|
| 4535 |
- testRequires(c, DaemonIsWindowsAtLeastBuild(15000)) |
|
| 4535 |
+ testRequires(c, DaemonIsWindowsAtLeastBuild(osversion.RS3)) |
|
| 4536 | 4536 |
out, _ := dockerCmd(c, "run", "--net=none", `--user=nt authority\system`, "--hostname=XYZZY", minimalBaseImage(), "cmd", "/c", `@echo %USERNAME%`) |
| 4537 | 4537 |
assert.Equal(c, strings.TrimSpace(out), "XYZZY$") |
| 4538 | 4538 |
} |
| ... | ... |
@@ -8,6 +8,8 @@ import ( |
| 8 | 8 |
"testing" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 12 |
+ |
|
| 11 | 13 |
"github.com/docker/docker/integration-cli/cli" |
| 12 | 14 |
"github.com/docker/docker/pkg/parsers/kernel" |
| 13 | 15 |
"gotest.tools/assert" |
| ... | ... |
@@ -196,7 +198,7 @@ func (s *DockerSuite) TestStartReturnCorrectExitCode(c *testing.T) {
|
| 196 | 196 |
v, err := kernel.GetKernelVersion() |
| 197 | 197 |
assert.NilError(c, err) |
| 198 | 198 |
build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0]) |
| 199 |
- if build < 16299 {
|
|
| 199 |
+ if build < osversion.RS3 {
|
|
| 200 | 200 |
c.Skip("FLAKY on Windows RS1, see #38521")
|
| 201 | 201 |
} |
| 202 | 202 |
} |
| ... | ... |
@@ -18,6 +18,7 @@ import ( |
| 18 | 18 |
"time" |
| 19 | 19 |
|
| 20 | 20 |
"github.com/Microsoft/hcsshim" |
| 21 |
+ "github.com/Microsoft/hcsshim/osversion" |
|
| 21 | 22 |
opengcs "github.com/Microsoft/opengcs/client" |
| 22 | 23 |
"github.com/containerd/containerd" |
| 23 | 24 |
"github.com/containerd/containerd/cio" |
| ... | ... |
@@ -318,7 +319,7 @@ func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions inter |
| 318 | 318 |
} |
| 319 | 319 |
} |
| 320 | 320 |
configuration.MappedDirectories = mds |
| 321 |
- if len(mps) > 0 && system.GetOSVersion().Build < 16299 { // RS3
|
|
| 321 |
+ if len(mps) > 0 && osversion.Build() < osversion.RS3 {
|
|
| 322 | 322 |
return errors.New("named pipe mounts are not supported on this version of Windows")
|
| 323 | 323 |
} |
| 324 | 324 |
configuration.MappedPipes = mps |
| ... | ... |
@@ -328,7 +329,7 @@ func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions inter |
| 328 | 328 |
if configuration.HvPartition {
|
| 329 | 329 |
return errors.New("device assignment is not supported for HyperV containers")
|
| 330 | 330 |
} |
| 331 |
- if system.GetOSVersion().Build < 17763 { // RS5
|
|
| 331 |
+ if osversion.Build() < osversion.RS5 {
|
|
| 332 | 332 |
return errors.New("device assignment requires Windows builds RS5 (17763+) or later")
|
| 333 | 333 |
} |
| 334 | 334 |
for _, d := range spec.Windows.Devices {
|
| ... | ... |
@@ -519,7 +520,7 @@ func (c *client) createLinux(id string, spec *specs.Spec, runtimeOptions interfa |
| 519 | 519 |
ReadOnly: readonly, |
| 520 | 520 |
} |
| 521 | 521 |
// If we are 1803/RS4+ enable LinuxMetadata support by default |
| 522 |
- if system.GetOSVersion().Build >= 17134 {
|
|
| 522 |
+ if osversion.Build() >= osversion.RS4 {
|
|
| 523 | 523 |
md.LinuxMetadata = true |
| 524 | 524 |
} |
| 525 | 525 |
mds = append(mds, md) |
| ... | ... |
@@ -18,8 +18,7 @@ var ( |
| 18 | 18 |
|
| 19 | 19 |
// InitLCOW sets whether LCOW is supported or not. Requires RS5+ |
| 20 | 20 |
func InitLCOW(experimental bool) {
|
| 21 |
- v := GetOSVersion() |
|
| 22 |
- if experimental && v.Build >= osversion.RS5 {
|
|
| 21 |
+ if experimental && osversion.Build() >= osversion.RS5 {
|
|
| 23 | 22 |
lcowSupported = true |
| 24 | 23 |
} |
| 25 | 24 |
} |