Skip to content

Commit 10d30c6

Browse files
committed
Add platformSupported flag to enable daemon mode by platform.
Signed-off-by: David Calavera <[email protected]>
1 parent 38e5764 commit 10d30c6

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

daemon/daemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemo
557557
config.DisableBridge = isBridgeNetworkDisabled(config)
558558

559559
// Verify the platform is supported as a daemon
560-
if runtime.GOOS != "linux" && runtime.GOOS != "windows" {
560+
if !platformSupported {
561561
return nil, ErrSystemNotSupported
562562
}
563563

daemon/daemon_unix.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !windows
1+
// +build linux freebsd
22

33
package daemon
44

@@ -36,6 +36,7 @@ const (
3636
// See https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/tree/kernel/sched/sched.h?id=8cd9234c64c584432f6992fe944ca9e46ca8ea76#n269
3737
linuxMinCPUShares = 2
3838
linuxMaxCPUShares = 262144
39+
platformSupported = true
3940
)
4041

4142
func (daemon *Daemon) Changes(container *Container) ([]archive.Change, error) {

daemon/daemon_unsupported.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// +build !linux,!freebsd,!windows
2+
3+
package daemon
4+
5+
const platformSupported = false

daemon/daemon_windows.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import (
1515
"github.com/microsoft/hcsshim"
1616
)
1717

18-
const DefaultVirtualSwitch = "Virtual Switch"
18+
const (
19+
DefaultVirtualSwitch = "Virtual Switch"
20+
platformSupported = true
21+
)
1922

2023
func (daemon *Daemon) Changes(container *Container) ([]archive.Change, error) {
2124
return daemon.driver.Changes(container.ID, container.ImageID)

0 commit comments

Comments
 (0)