Signed-off-by: Darren Stahl <darst@microsoft.com>
| ... | ... |
@@ -217,7 +217,7 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes. |
| 217 | 217 |
warnings := []string{}
|
| 218 | 218 |
|
| 219 | 219 |
hyperv := daemon.runAsHyperVContainer(hostConfig) |
| 220 |
- if !hyperv && system.IsWindowsClient() {
|
|
| 220 |
+ if !hyperv && system.IsWindowsClient() && !system.IsIoTCore() {
|
|
| 221 | 221 |
// @engine maintainers. This block should not be removed. It partially enforces licensing |
| 222 | 222 |
// restrictions on Windows. Ping @jhowardmsft if there are concerns or PRs to change this. |
| 223 | 223 |
return warnings, fmt.Errorf("Windows client operating systems only support Hyper-V containers")
|
| ... | ... |
@@ -566,8 +566,9 @@ func (daemon *Daemon) stats(c *container.Container) (*types.StatsJSON, error) {
|
| 566 | 566 |
// daemon to run in. This is only applicable on Windows |
| 567 | 567 |
func (daemon *Daemon) setDefaultIsolation() error {
|
| 568 | 568 |
daemon.defaultIsolation = containertypes.Isolation("process")
|
| 569 |
- // On client SKUs, default to Hyper-V |
|
| 570 |
- if system.IsWindowsClient() {
|
|
| 569 |
+ // On client SKUs, default to Hyper-V. Note that IoT reports as a client SKU |
|
| 570 |
+ // but it should not be treated as such. |
|
| 571 |
+ if system.IsWindowsClient() && !system.IsIoTCore() {
|
|
| 571 | 572 |
daemon.defaultIsolation = containertypes.Isolation("hyperv")
|
| 572 | 573 |
} |
| 573 | 574 |
for _, option := range daemon.configStore.ExecOptions {
|
| ... | ... |
@@ -586,7 +587,7 @@ func (daemon *Daemon) setDefaultIsolation() error {
|
| 586 | 586 |
daemon.defaultIsolation = containertypes.Isolation("hyperv")
|
| 587 | 587 |
} |
| 588 | 588 |
if containertypes.Isolation(val).IsProcess() {
|
| 589 |
- if system.IsWindowsClient() {
|
|
| 589 |
+ if system.IsWindowsClient() && !system.IsIoTCore() {
|
|
| 590 | 590 |
// @engine maintainers. This block should not be removed. It partially enforces licensing |
| 591 | 591 |
// restrictions on Windows. Ping @jhowardmsft if there are concerns or PRs to change this. |
| 592 | 592 |
return fmt.Errorf("Windows client operating systems only support Hyper-V containers")
|
| ... | ... |
@@ -8,8 +8,9 @@ import ( |
| 8 | 8 |
) |
| 9 | 9 |
|
| 10 | 10 |
var ( |
| 11 |
- ntuserApiset = syscall.NewLazyDLL("ext-ms-win-ntuser-window-l1-1-0")
|
|
| 12 |
- procGetVersionExW = modkernel32.NewProc("GetVersionExW")
|
|
| 11 |
+ ntuserApiset = syscall.NewLazyDLL("ext-ms-win-ntuser-window-l1-1-0")
|
|
| 12 |
+ procGetVersionExW = modkernel32.NewProc("GetVersionExW")
|
|
| 13 |
+ procGetProductInfo = modkernel32.NewProc("GetProductInfo")
|
|
| 13 | 14 |
) |
| 14 | 15 |
|
| 15 | 16 |
// OSVersion is a wrapper for Windows version information |
| ... | ... |
@@ -66,6 +67,22 @@ func IsWindowsClient() bool {
|
| 66 | 66 |
return osviex.ProductType == verNTWorkstation |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
+// IsIoTCore returns true if the currently running image is based off of |
|
| 70 |
+// Windows 10 IoT Core. |
|
| 71 |
+// @engine maintainers - this function should not be removed or modified as it |
|
| 72 |
+// is used to enforce licensing restrictions on Windows. |
|
| 73 |
+func IsIoTCore() bool {
|
|
| 74 |
+ var returnedProductType uint32 |
|
| 75 |
+ r1, _, err := procGetProductInfo.Call(6, 1, 0, 0, uintptr(unsafe.Pointer(&returnedProductType))) |
|
| 76 |
+ if r1 == 0 {
|
|
| 77 |
+ logrus.Warnf("GetProductInfo failed - assuming this is not IoT: %v", err)
|
|
| 78 |
+ return false |
|
| 79 |
+ } |
|
| 80 |
+ const productIoTUAP = 0x0000007B |
|
| 81 |
+ const productIoTUAPCommercial = 0x00000083 |
|
| 82 |
+ return returnedProductType == productIoTUAP || returnedProductType == productIoTUAPCommercial |
|
| 83 |
+} |
|
| 84 |
+ |
|
| 69 | 85 |
// Unmount is a platform-specific helper function to call |
| 70 | 86 |
// the unmount syscall. Not supported on Windows |
| 71 | 87 |
func Unmount(dest string) error {
|