Remove solaris files
Sebastiaan van Stijn authored on 2017/10/25 22:14:041 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,19 +0,0 @@ |
1 |
-# Defines an image that hosts a native Docker build environment for Solaris |
|
2 |
-# TODO: Improve stub |
|
3 |
- |
|
4 |
-FROM solaris:latest |
|
5 |
- |
|
6 |
-# compile and runtime deps |
|
7 |
-RUN pkg install --accept \ |
|
8 |
- git \ |
|
9 |
- gnu-coreutils \ |
|
10 |
- gnu-make \ |
|
11 |
- gnu-tar \ |
|
12 |
- diagnostic/top \ |
|
13 |
- golang \ |
|
14 |
- library/golang/* \ |
|
15 |
- developer/gcc-* |
|
16 |
- |
|
17 |
-ENV GOPATH /go/:/usr/lib/gocode/1.5/ |
|
18 |
-WORKDIR /go/src/github.com/docker/docker |
|
19 |
-COPY . /go/src/github.com/docker/docker |
... | ... |
@@ -3,7 +3,6 @@ |
3 | 3 |
package main |
4 | 4 |
|
5 | 5 |
import ( |
6 |
- "runtime" |
|
7 | 6 |
"testing" |
8 | 7 |
|
9 | 8 |
"github.com/docker/docker/daemon/config" |
... | ... |
@@ -12,9 +11,6 @@ import ( |
12 | 12 |
) |
13 | 13 |
|
14 | 14 |
func TestDaemonParseShmSize(t *testing.T) { |
15 |
- if runtime.GOOS == "solaris" { |
|
16 |
- t.Skip("ShmSize not supported on Solaris\n") |
|
17 |
- } |
|
18 | 15 |
flags := pflag.NewFlagSet("test", pflag.ContinueOnError) |
19 | 16 |
|
20 | 17 |
conf := &config.Config{} |
21 | 18 |
deleted file mode 100644 |
... | ... |
@@ -1,64 +0,0 @@ |
1 |
-// +build solaris |
|
2 |
- |
|
3 |
-package main |
|
4 |
- |
|
5 |
-import ( |
|
6 |
- "fmt" |
|
7 |
- "net" |
|
8 |
- "path/filepath" |
|
9 |
- |
|
10 |
- "github.com/docker/docker/libcontainerd" |
|
11 |
- "golang.org/x/sys/unix" |
|
12 |
-) |
|
13 |
- |
|
14 |
-const defaultDaemonConfigFile = "" |
|
15 |
- |
|
16 |
-// setDefaultUmask sets the umask to 0022 to avoid problems |
|
17 |
-// caused by custom umask |
|
18 |
-func setDefaultUmask() error { |
|
19 |
- desiredUmask := 0022 |
|
20 |
- unix.Umask(desiredUmask) |
|
21 |
- if umask := unix.Umask(desiredUmask); umask != desiredUmask { |
|
22 |
- return fmt.Errorf("failed to set umask: expected %#o, got %#o", desiredUmask, umask) |
|
23 |
- } |
|
24 |
- |
|
25 |
- return nil |
|
26 |
-} |
|
27 |
- |
|
28 |
-func getDaemonConfDir(_ string) string { |
|
29 |
- return "/etc/docker" |
|
30 |
-} |
|
31 |
- |
|
32 |
-// setupConfigReloadTrap configures the USR2 signal to reload the configuration. |
|
33 |
-func (cli *DaemonCli) setupConfigReloadTrap() { |
|
34 |
-} |
|
35 |
- |
|
36 |
-// preNotifySystem sends a message to the host when the API is active, but before the daemon is |
|
37 |
-func preNotifySystem() { |
|
38 |
-} |
|
39 |
- |
|
40 |
-// notifySystem sends a message to the host when the server is ready to be used |
|
41 |
-func notifySystem() { |
|
42 |
-} |
|
43 |
- |
|
44 |
-func (cli *DaemonCli) getPlatformRemoteOptions() ([]libcontainerd.RemoteOption, error) { |
|
45 |
- return nil, nil |
|
46 |
-} |
|
47 |
- |
|
48 |
-// getSwarmRunRoot gets the root directory for swarm to store runtime state |
|
49 |
-// For example, the control socket |
|
50 |
-func (cli *DaemonCli) getSwarmRunRoot() string { |
|
51 |
- return filepath.Join(cli.Config.ExecRoot, "swarm") |
|
52 |
-} |
|
53 |
- |
|
54 |
-func allocateDaemonPort(addr string) error { |
|
55 |
- return nil |
|
56 |
-} |
|
57 |
- |
|
58 |
-// notifyShutdown is called after the daemon shuts down but before the process exits. |
|
59 |
-func notifyShutdown(err error) { |
|
60 |
-} |
|
61 |
- |
|
62 |
-func wrapListeners(proto string, ls []net.Listener) []net.Listener { |
|
63 |
- return ls |
|
64 |
-} |
... | ... |
@@ -129,8 +129,8 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str |
129 | 129 |
return "", err |
130 | 130 |
} |
131 | 131 |
|
132 |
- // It is not possible to commit a running container on Windows and on Solaris. |
|
133 |
- if (runtime.GOOS == "windows" || runtime.GOOS == "solaris") && container.IsRunning() { |
|
132 |
+ // It is not possible to commit a running container on Windows |
|
133 |
+ if (runtime.GOOS == "windows") && container.IsRunning() { |
|
134 | 134 |
return "", errors.Errorf("%+v does not support commit of a running container", runtime.GOOS) |
135 | 135 |
} |
136 | 136 |
|
... | ... |
@@ -204,9 +204,6 @@ func New() *Config { |
204 | 204 |
|
205 | 205 |
// ParseClusterAdvertiseSettings parses the specified advertise settings |
206 | 206 |
func ParseClusterAdvertiseSettings(clusterStore, clusterAdvertise string) (string, error) { |
207 |
- if runtime.GOOS == "solaris" && (clusterAdvertise != "" || clusterStore != "") { |
|
208 |
- return "", errors.New("Cluster Advertise Settings not supported on Solaris") |
|
209 |
- } |
|
210 | 207 |
if clusterAdvertise == "" { |
211 | 208 |
return "", daemondiscovery.ErrDiscoveryDisabled |
212 | 209 |
} |
... | ... |
@@ -3,7 +3,6 @@ package config |
3 | 3 |
import ( |
4 | 4 |
"io/ioutil" |
5 | 5 |
"os" |
6 |
- "runtime" |
|
7 | 6 |
"strings" |
8 | 7 |
"testing" |
9 | 8 |
|
... | ... |
@@ -38,9 +37,6 @@ func TestDaemonBrokenConfiguration(t *testing.T) { |
38 | 38 |
} |
39 | 39 |
|
40 | 40 |
func TestParseClusterAdvertiseSettings(t *testing.T) { |
41 |
- if runtime.GOOS == "solaris" { |
|
42 |
- t.Skip("ClusterSettings not supported on Solaris\n") |
|
43 |
- } |
|
44 | 41 |
_, err := ParseClusterAdvertiseSettings("something", "") |
45 | 42 |
if err != discovery.ErrDiscoveryDisabled { |
46 | 43 |
t.Fatalf("expected discovery disabled error, got %v\n", err) |
47 | 44 |
deleted file mode 100644 |
... | ... |
@@ -1,47 +0,0 @@ |
1 |
-// +build solaris |
|
2 |
- |
|
3 |
-package daemon |
|
4 |
- |
|
5 |
-import ( |
|
6 |
- "github.com/docker/docker/container" |
|
7 |
- "github.com/docker/docker/runconfig" |
|
8 |
- "github.com/docker/libnetwork" |
|
9 |
-) |
|
10 |
- |
|
11 |
-func (daemon *Daemon) setupLinkedContainers(container *container.Container) ([]string, error) { |
|
12 |
- return nil, nil |
|
13 |
-} |
|
14 |
- |
|
15 |
-func (daemon *Daemon) setupIpcDirs(container *container.Container) error { |
|
16 |
- return nil |
|
17 |
-} |
|
18 |
- |
|
19 |
-func killProcessDirectly(container *container.Container) error { |
|
20 |
- return nil |
|
21 |
-} |
|
22 |
- |
|
23 |
-func detachMounted(path string) error { |
|
24 |
- return nil |
|
25 |
-} |
|
26 |
- |
|
27 |
-func isLinkable(child *container.Container) bool { |
|
28 |
- // A container is linkable only if it belongs to the default network |
|
29 |
- _, ok := child.NetworkSettings.Networks[runconfig.DefaultDaemonNetworkMode().NetworkName()] |
|
30 |
- return ok |
|
31 |
-} |
|
32 |
- |
|
33 |
-func enableIPOnPredefinedNetwork() bool { |
|
34 |
- return false |
|
35 |
-} |
|
36 |
- |
|
37 |
-func (daemon *Daemon) isNetworkHotPluggable() bool { |
|
38 |
- return false |
|
39 |
-} |
|
40 |
- |
|
41 |
-func setupPathsAndSandboxOptions(container *container.Container, sboxOptions *[]libnetwork.SandboxOption) error { |
|
42 |
- return nil |
|
43 |
-} |
|
44 |
- |
|
45 |
-func (daemon *Daemon) initializeNetworkingPaths(container *container.Container, nc *container.Container) error { |
|
46 |
- return nil |
|
47 |
-} |
... | ... |
@@ -96,10 +96,6 @@ func (daemon *Daemon) create(params types.ContainerCreateConfig, managed bool) ( |
96 | 96 |
return nil, err |
97 | 97 |
} |
98 | 98 |
os = img.OS |
99 |
- |
|
100 |
- if runtime.GOOS == "solaris" && img.OS != "solaris " { |
|
101 |
- return nil, errors.New("operating system on which parent image was created is not Solaris") |
|
102 |
- } |
|
103 | 99 |
imgID = img.ID() |
104 | 100 |
|
105 | 101 |
if runtime.GOOS == "windows" && img.OS == "linux" && !system.LCOWSupported() { |
106 | 102 |
deleted file mode 100644 |
... | ... |
@@ -1,530 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package daemon |
|
4 |
- |
|
5 |
-import ( |
|
6 |
- "fmt" |
|
7 |
- "net" |
|
8 |
- "strconv" |
|
9 |
- |
|
10 |
- "github.com/docker/docker/api/types" |
|
11 |
- containertypes "github.com/docker/docker/api/types/container" |
|
12 |
- "github.com/docker/docker/container" |
|
13 |
- "github.com/docker/docker/daemon/config" |
|
14 |
- "github.com/docker/docker/image" |
|
15 |
- "github.com/docker/docker/pkg/containerfs" |
|
16 |
- "github.com/docker/docker/pkg/fileutils" |
|
17 |
- "github.com/docker/docker/pkg/idtools" |
|
18 |
- "github.com/docker/docker/pkg/parsers/kernel" |
|
19 |
- "github.com/docker/docker/pkg/sysinfo" |
|
20 |
- "github.com/docker/libnetwork" |
|
21 |
- nwconfig "github.com/docker/libnetwork/config" |
|
22 |
- "github.com/docker/libnetwork/drivers/solaris/bridge" |
|
23 |
- "github.com/docker/libnetwork/netlabel" |
|
24 |
- "github.com/docker/libnetwork/netutils" |
|
25 |
- lntypes "github.com/docker/libnetwork/types" |
|
26 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
27 |
- "github.com/opencontainers/selinux/go-selinux/label" |
|
28 |
- "github.com/pkg/errors" |
|
29 |
- "github.com/sirupsen/logrus" |
|
30 |
-) |
|
31 |
- |
|
32 |
-//#include <zone.h> |
|
33 |
-import "C" |
|
34 |
- |
|
35 |
-const ( |
|
36 |
- platformSupported = true |
|
37 |
- solarisMinCPUShares = 1 |
|
38 |
- solarisMaxCPUShares = 65535 |
|
39 |
-) |
|
40 |
- |
|
41 |
-func getMemoryResources(config containertypes.Resources) specs.CappedMemory { |
|
42 |
- memory := specs.CappedMemory{ |
|
43 |
- DisableOOMKiller: config.OomKillDisable, |
|
44 |
- } |
|
45 |
- |
|
46 |
- if config.Memory > 0 { |
|
47 |
- memory.Physical = strconv.FormatInt(config.Memory, 10) |
|
48 |
- } |
|
49 |
- |
|
50 |
- if config.MemorySwap != 0 { |
|
51 |
- memory.Swap = strconv.FormatInt(config.MemorySwap, 10) |
|
52 |
- } |
|
53 |
- |
|
54 |
- return memory |
|
55 |
-} |
|
56 |
- |
|
57 |
-func getCPUResources(config containertypes.Resources) specs.CappedCPU { |
|
58 |
- cpu := specs.CappedCPU{} |
|
59 |
- |
|
60 |
- if config.CpusetCpus != "" { |
|
61 |
- cpu.Ncpus = config.CpusetCpus |
|
62 |
- } |
|
63 |
- |
|
64 |
- return cpu |
|
65 |
-} |
|
66 |
- |
|
67 |
-func (daemon *Daemon) cleanupMountsByID(id string) error { |
|
68 |
- return nil |
|
69 |
-} |
|
70 |
- |
|
71 |
-func (daemon *Daemon) parseSecurityOpt(container *container.Container, hostConfig *containertypes.HostConfig) error { |
|
72 |
- return parseSecurityOpt(container, hostConfig) |
|
73 |
-} |
|
74 |
- |
|
75 |
-func parseSecurityOpt(container *container.Container, config *containertypes.HostConfig) error { |
|
76 |
- //Since hostConfig.SecurityOpt is specifically defined as a "List of string values to |
|
77 |
- //customize labels for MLs systems, such as SELinux" |
|
78 |
- //until we figure out how to map to Trusted Extensions |
|
79 |
- //this is being disabled for now on Solaris |
|
80 |
- var ( |
|
81 |
- labelOpts []string |
|
82 |
- err error |
|
83 |
- ) |
|
84 |
- |
|
85 |
- if len(config.SecurityOpt) > 0 { |
|
86 |
- return errors.New("Security options are not supported on Solaris") |
|
87 |
- } |
|
88 |
- |
|
89 |
- container.ProcessLabel, container.MountLabel, err = label.InitLabels(labelOpts) |
|
90 |
- return err |
|
91 |
-} |
|
92 |
- |
|
93 |
-func setupRemappedRoot(config *config.Config) (*idtools.IDMappings, error) { |
|
94 |
- return nil, nil |
|
95 |
-} |
|
96 |
- |
|
97 |
-func setupDaemonRoot(config *config.Config, rootDir string, rootIDs idtools.IDPair) error { |
|
98 |
- return nil |
|
99 |
-} |
|
100 |
- |
|
101 |
-func (daemon *Daemon) getLayerInit() func(containerfs.ContainerFS) error { |
|
102 |
- return nil |
|
103 |
-} |
|
104 |
- |
|
105 |
-func checkKernel() error { |
|
106 |
- // solaris can rely upon checkSystem() below, we don't skew kernel versions |
|
107 |
- return nil |
|
108 |
-} |
|
109 |
- |
|
110 |
-func (daemon *Daemon) getCgroupDriver() string { |
|
111 |
- return "" |
|
112 |
-} |
|
113 |
- |
|
114 |
-func (daemon *Daemon) adaptContainerSettings(hostConfig *containertypes.HostConfig, adjustCPUShares bool) error { |
|
115 |
- if hostConfig.CPUShares < 0 { |
|
116 |
- logrus.Warnf("Changing requested CPUShares of %d to minimum allowed of %d", hostConfig.CPUShares, solarisMinCPUShares) |
|
117 |
- hostConfig.CPUShares = solarisMinCPUShares |
|
118 |
- } else if hostConfig.CPUShares > solarisMaxCPUShares { |
|
119 |
- logrus.Warnf("Changing requested CPUShares of %d to maximum allowed of %d", hostConfig.CPUShares, solarisMaxCPUShares) |
|
120 |
- hostConfig.CPUShares = solarisMaxCPUShares |
|
121 |
- } |
|
122 |
- |
|
123 |
- if hostConfig.Memory > 0 && hostConfig.MemorySwap == 0 { |
|
124 |
- // By default, MemorySwap is set to twice the size of Memory. |
|
125 |
- hostConfig.MemorySwap = hostConfig.Memory * 2 |
|
126 |
- } |
|
127 |
- |
|
128 |
- if hostConfig.ShmSize != 0 { |
|
129 |
- hostConfig.ShmSize = container.DefaultSHMSize |
|
130 |
- } |
|
131 |
- if hostConfig.OomKillDisable == nil { |
|
132 |
- defaultOomKillDisable := false |
|
133 |
- hostConfig.OomKillDisable = &defaultOomKillDisable |
|
134 |
- } |
|
135 |
- |
|
136 |
- return nil |
|
137 |
-} |
|
138 |
- |
|
139 |
-// UsingSystemd returns true if cli option includes native.cgroupdriver=systemd |
|
140 |
-func UsingSystemd(config *config.Config) bool { |
|
141 |
- return false |
|
142 |
-} |
|
143 |
- |
|
144 |
-// verifyPlatformContainerSettings performs platform-specific validation of the |
|
145 |
-// hostconfig and config structures. |
|
146 |
-func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.HostConfig, config *containertypes.Config, update bool) ([]string, error) { |
|
147 |
- fixMemorySwappiness(resources) |
|
148 |
- warnings := []string{} |
|
149 |
- sysInfo := sysinfo.New(true) |
|
150 |
- // NOTE: We do not enforce a minimum value for swap limits for zones on Solaris and |
|
151 |
- // therefore we will not do that for Docker container either. |
|
152 |
- if hostConfig.Memory > 0 && !sysInfo.MemoryLimit { |
|
153 |
- warnings = append(warnings, "Your kernel does not support memory limit capabilities. Limitation discarded.") |
|
154 |
- logrus.Warnf("Your kernel does not support memory limit capabilities. Limitation discarded.") |
|
155 |
- hostConfig.Memory = 0 |
|
156 |
- hostConfig.MemorySwap = -1 |
|
157 |
- } |
|
158 |
- if hostConfig.Memory > 0 && hostConfig.MemorySwap != -1 && !sysInfo.SwapLimit { |
|
159 |
- warnings = append(warnings, "Your kernel does not support swap limit capabilities, memory limited without swap.") |
|
160 |
- logrus.Warnf("Your kernel does not support swap limit capabilities, memory limited without swap.") |
|
161 |
- hostConfig.MemorySwap = -1 |
|
162 |
- } |
|
163 |
- if hostConfig.Memory > 0 && hostConfig.MemorySwap > 0 && hostConfig.MemorySwap < hostConfig.Memory { |
|
164 |
- return warnings, fmt.Errorf("Minimum memoryswap limit should be larger than memory limit, see usage.") |
|
165 |
- } |
|
166 |
- // Solaris NOTE: We allow and encourage setting the swap without setting the memory limit. |
|
167 |
- |
|
168 |
- if hostConfig.MemorySwappiness != nil && !sysInfo.MemorySwappiness { |
|
169 |
- warnings = append(warnings, "Your kernel does not support memory swappiness capabilities, memory swappiness discarded.") |
|
170 |
- logrus.Warnf("Your kernel does not support memory swappiness capabilities, memory swappiness discarded.") |
|
171 |
- hostConfig.MemorySwappiness = nil |
|
172 |
- } |
|
173 |
- if hostConfig.MemoryReservation > 0 && !sysInfo.MemoryReservation { |
|
174 |
- warnings = append(warnings, "Your kernel does not support memory soft limit capabilities. Limitation discarded.") |
|
175 |
- logrus.Warnf("Your kernel does not support memory soft limit capabilities. Limitation discarded.") |
|
176 |
- hostConfig.MemoryReservation = 0 |
|
177 |
- } |
|
178 |
- if hostConfig.Memory > 0 && hostConfig.MemoryReservation > 0 && hostConfig.Memory < hostConfig.MemoryReservation { |
|
179 |
- return warnings, fmt.Errorf("Minimum memory limit should be larger than memory reservation limit, see usage.") |
|
180 |
- } |
|
181 |
- if hostConfig.KernelMemory > 0 && !sysInfo.KernelMemory { |
|
182 |
- warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities. Limitation discarded.") |
|
183 |
- logrus.Warnf("Your kernel does not support kernel memory limit capabilities. Limitation discarded.") |
|
184 |
- hostConfig.KernelMemory = 0 |
|
185 |
- } |
|
186 |
- if hostConfig.CPUShares != 0 && !sysInfo.CPUShares { |
|
187 |
- warnings = append(warnings, "Your kernel does not support CPU shares. Shares discarded.") |
|
188 |
- logrus.Warnf("Your kernel does not support CPU shares. Shares discarded.") |
|
189 |
- hostConfig.CPUShares = 0 |
|
190 |
- } |
|
191 |
- if hostConfig.CPUShares < 0 { |
|
192 |
- warnings = append(warnings, "Invalid CPUShares value. Must be positive. Discarding.") |
|
193 |
- logrus.Warnf("Invalid CPUShares value. Must be positive. Discarding.") |
|
194 |
- hostConfig.CPUQuota = 0 |
|
195 |
- } |
|
196 |
- if hostConfig.CPUShares > 0 && !sysinfo.IsCPUSharesAvailable() { |
|
197 |
- warnings = append(warnings, "Global zone default scheduling class not FSS. Discarding shares.") |
|
198 |
- logrus.Warnf("Global zone default scheduling class not FSS. Discarding shares.") |
|
199 |
- hostConfig.CPUShares = 0 |
|
200 |
- } |
|
201 |
- |
|
202 |
- // Solaris NOTE: Linux does not do negative checking for CPUShares and Quota here. But it makes sense to. |
|
203 |
- if hostConfig.CPUPeriod > 0 && !sysInfo.CPUCfsPeriod { |
|
204 |
- warnings = append(warnings, "Your kernel does not support CPU cfs period. Period discarded.") |
|
205 |
- logrus.Warnf("Your kernel does not support CPU cfs period. Period discarded.") |
|
206 |
- if hostConfig.CPUQuota > 0 { |
|
207 |
- warnings = append(warnings, "Quota will be applied on default period, not period specified.") |
|
208 |
- logrus.Warnf("Quota will be applied on default period, not period specified.") |
|
209 |
- } |
|
210 |
- hostConfig.CPUPeriod = 0 |
|
211 |
- } |
|
212 |
- if hostConfig.CPUQuota != 0 && !sysInfo.CPUCfsQuota { |
|
213 |
- warnings = append(warnings, "Your kernel does not support CPU cfs quota. Quota discarded.") |
|
214 |
- logrus.Warnf("Your kernel does not support CPU cfs quota. Quota discarded.") |
|
215 |
- hostConfig.CPUQuota = 0 |
|
216 |
- } |
|
217 |
- if hostConfig.CPUQuota < 0 { |
|
218 |
- warnings = append(warnings, "Invalid CPUQuota value. Must be positive. Discarding.") |
|
219 |
- logrus.Warnf("Invalid CPUQuota value. Must be positive. Discarding.") |
|
220 |
- hostConfig.CPUQuota = 0 |
|
221 |
- } |
|
222 |
- if (hostConfig.CpusetCpus != "" || hostConfig.CpusetMems != "") && !sysInfo.Cpuset { |
|
223 |
- warnings = append(warnings, "Your kernel does not support cpuset. Cpuset discarded.") |
|
224 |
- logrus.Warnf("Your kernel does not support cpuset. Cpuset discarded.") |
|
225 |
- hostConfig.CpusetCpus = "" |
|
226 |
- hostConfig.CpusetMems = "" |
|
227 |
- } |
|
228 |
- cpusAvailable, err := sysInfo.IsCpusetCpusAvailable(hostConfig.CpusetCpus) |
|
229 |
- if err != nil { |
|
230 |
- return warnings, fmt.Errorf("Invalid value %s for cpuset cpus.", hostConfig.CpusetCpus) |
|
231 |
- } |
|
232 |
- if !cpusAvailable { |
|
233 |
- return warnings, fmt.Errorf("Requested CPUs are not available - requested %s, available: %s.", hostConfig.CpusetCpus, sysInfo.Cpus) |
|
234 |
- } |
|
235 |
- memsAvailable, err := sysInfo.IsCpusetMemsAvailable(hostConfig.CpusetMems) |
|
236 |
- if err != nil { |
|
237 |
- return warnings, fmt.Errorf("Invalid value %s for cpuset mems.", hostConfig.CpusetMems) |
|
238 |
- } |
|
239 |
- if !memsAvailable { |
|
240 |
- return warnings, fmt.Errorf("Requested memory nodes are not available - requested %s, available: %s.", hostConfig.CpusetMems, sysInfo.Mems) |
|
241 |
- } |
|
242 |
- if hostConfig.BlkioWeight > 0 && !sysInfo.BlkioWeight { |
|
243 |
- warnings = append(warnings, "Your kernel does not support Block I/O weight. Weight discarded.") |
|
244 |
- logrus.Warnf("Your kernel does not support Block I/O weight. Weight discarded.") |
|
245 |
- hostConfig.BlkioWeight = 0 |
|
246 |
- } |
|
247 |
- if hostConfig.OomKillDisable != nil && !sysInfo.OomKillDisable { |
|
248 |
- *hostConfig.OomKillDisable = false |
|
249 |
- // Don't warn; this is the default setting but only applicable to Linux |
|
250 |
- } |
|
251 |
- |
|
252 |
- if sysInfo.IPv4ForwardingDisabled { |
|
253 |
- warnings = append(warnings, "IPv4 forwarding is disabled. Networking will not work.") |
|
254 |
- logrus.Warnf("IPv4 forwarding is disabled. Networking will not work") |
|
255 |
- } |
|
256 |
- |
|
257 |
- // Solaris NOTE: We do not allow setting Linux specific options, so check and warn for all of them. |
|
258 |
- |
|
259 |
- if hostConfig.CapAdd != nil || hostConfig.CapDrop != nil { |
|
260 |
- warnings = append(warnings, "Adding or dropping kernel capabilities unsupported on Solaris.Discarding capabilities lists.") |
|
261 |
- logrus.Warnf("Adding or dropping kernel capabilities unsupported on Solaris.Discarding capabilities lists.") |
|
262 |
- hostConfig.CapAdd = nil |
|
263 |
- hostConfig.CapDrop = nil |
|
264 |
- } |
|
265 |
- |
|
266 |
- if hostConfig.GroupAdd != nil { |
|
267 |
- warnings = append(warnings, "Additional groups unsupported on Solaris.Discarding groups lists.") |
|
268 |
- logrus.Warnf("Additional groups unsupported on Solaris.Discarding groups lists.") |
|
269 |
- hostConfig.GroupAdd = nil |
|
270 |
- } |
|
271 |
- |
|
272 |
- if hostConfig.IpcMode != "" { |
|
273 |
- warnings = append(warnings, "IPC namespace assignment unsupported on Solaris.Discarding IPC setting.") |
|
274 |
- logrus.Warnf("IPC namespace assignment unsupported on Solaris.Discarding IPC setting.") |
|
275 |
- hostConfig.IpcMode = "" |
|
276 |
- } |
|
277 |
- |
|
278 |
- if hostConfig.PidMode != "" { |
|
279 |
- warnings = append(warnings, "PID namespace setting unsupported on Solaris. Running container in host PID namespace.") |
|
280 |
- logrus.Warnf("PID namespace setting unsupported on Solaris. Running container in host PID namespace.") |
|
281 |
- hostConfig.PidMode = "" |
|
282 |
- } |
|
283 |
- |
|
284 |
- if hostConfig.Privileged { |
|
285 |
- warnings = append(warnings, "Privileged mode unsupported on Solaris. Discarding privileged mode setting.") |
|
286 |
- logrus.Warnf("Privileged mode unsupported on Solaris. Discarding privileged mode setting.") |
|
287 |
- hostConfig.Privileged = false |
|
288 |
- } |
|
289 |
- |
|
290 |
- if hostConfig.UTSMode != "" { |
|
291 |
- warnings = append(warnings, "UTS namespace assignment unsupported on Solaris.Discarding UTS setting.") |
|
292 |
- logrus.Warnf("UTS namespace assignment unsupported on Solaris.Discarding UTS setting.") |
|
293 |
- hostConfig.UTSMode = "" |
|
294 |
- } |
|
295 |
- |
|
296 |
- if hostConfig.CgroupParent != "" { |
|
297 |
- warnings = append(warnings, "Specifying Cgroup parent unsupported on Solaris. Discarding cgroup parent setting.") |
|
298 |
- logrus.Warnf("Specifying Cgroup parent unsupported on Solaris. Discarding cgroup parent setting.") |
|
299 |
- hostConfig.CgroupParent = "" |
|
300 |
- } |
|
301 |
- |
|
302 |
- if hostConfig.Ulimits != nil { |
|
303 |
- warnings = append(warnings, "Specifying ulimits unsupported on Solaris. Discarding ulimits setting.") |
|
304 |
- logrus.Warnf("Specifying ulimits unsupported on Solaris. Discarding ulimits setting.") |
|
305 |
- hostConfig.Ulimits = nil |
|
306 |
- } |
|
307 |
- |
|
308 |
- return warnings, nil |
|
309 |
-} |
|
310 |
- |
|
311 |
-// reloadPlatform updates configuration with platform specific options |
|
312 |
-// and updates the passed attributes |
|
313 |
-func (daemon *Daemon) reloadPlatform(conf *config.Config, attributes map[string]string) error { |
|
314 |
- return nil |
|
315 |
-} |
|
316 |
- |
|
317 |
-// verifyDaemonSettings performs validation of daemon config struct |
|
318 |
-func verifyDaemonSettings(conf *config.Config) error { |
|
319 |
- |
|
320 |
- if conf.DefaultRuntime == "" { |
|
321 |
- conf.DefaultRuntime = stockRuntimeName |
|
322 |
- } |
|
323 |
- if conf.Runtimes == nil { |
|
324 |
- conf.Runtimes = make(map[string]types.Runtime) |
|
325 |
- } |
|
326 |
- stockRuntimeOpts := []string{} |
|
327 |
- conf.Runtimes[stockRuntimeName] = types.Runtime{Path: DefaultRuntimeBinary, Args: stockRuntimeOpts} |
|
328 |
- |
|
329 |
- return nil |
|
330 |
-} |
|
331 |
- |
|
332 |
-// checkSystem validates platform-specific requirements |
|
333 |
-func checkSystem() error { |
|
334 |
- // check OS version for compatibility, ensure running in global zone |
|
335 |
- var err error |
|
336 |
- var id C.zoneid_t |
|
337 |
- |
|
338 |
- if id, err = C.getzoneid(); err != nil { |
|
339 |
- return fmt.Errorf("Exiting. Error getting zone id: %+v", err) |
|
340 |
- } |
|
341 |
- if int(id) != 0 { |
|
342 |
- return fmt.Errorf("Exiting because the Docker daemon is not running in the global zone") |
|
343 |
- } |
|
344 |
- |
|
345 |
- v, err := kernel.GetKernelVersion() |
|
346 |
- if kernel.CompareKernelVersion(*v, kernel.VersionInfo{Kernel: 5, Major: 12, Minor: 0}) < 0 { |
|
347 |
- return fmt.Errorf("Your Solaris kernel version: %s doesn't support Docker. Please upgrade to 5.12.0", v.String()) |
|
348 |
- } |
|
349 |
- return err |
|
350 |
-} |
|
351 |
- |
|
352 |
-// configureMaxThreads sets the Go runtime max threads threshold |
|
353 |
-// which is 90% of the kernel setting from /proc/sys/kernel/threads-max |
|
354 |
-func configureMaxThreads(config *config.Config) error { |
|
355 |
- return nil |
|
356 |
-} |
|
357 |
- |
|
358 |
-// configureKernelSecuritySupport configures and validates security support for the kernel |
|
359 |
-func configureKernelSecuritySupport(config *config.Config, driverNames []string) error { |
|
360 |
- return nil |
|
361 |
-} |
|
362 |
- |
|
363 |
-func (daemon *Daemon) initNetworkController(config *config.Config, activeSandboxes map[string]interface{}) (libnetwork.NetworkController, error) { |
|
364 |
- netOptions, err := daemon.networkOptions(config, daemon.PluginStore, activeSandboxes) |
|
365 |
- if err != nil { |
|
366 |
- return nil, err |
|
367 |
- } |
|
368 |
- |
|
369 |
- controller, err := libnetwork.New(netOptions...) |
|
370 |
- if err != nil { |
|
371 |
- return nil, fmt.Errorf("error obtaining controller instance: %v", err) |
|
372 |
- } |
|
373 |
- |
|
374 |
- // Initialize default network on "null" |
|
375 |
- if _, err := controller.NewNetwork("null", "none", "", libnetwork.NetworkOptionPersist(false)); err != nil { |
|
376 |
- return nil, fmt.Errorf("Error creating default 'null' network: %v", err) |
|
377 |
- } |
|
378 |
- |
|
379 |
- if !config.DisableBridge { |
|
380 |
- // Initialize default driver "bridge" |
|
381 |
- if err := initBridgeDriver(controller, config); err != nil { |
|
382 |
- return nil, err |
|
383 |
- } |
|
384 |
- } |
|
385 |
- |
|
386 |
- return controller, nil |
|
387 |
-} |
|
388 |
- |
|
389 |
-func initBridgeDriver(controller libnetwork.NetworkController, config *config.Config) error { |
|
390 |
- if n, err := controller.NetworkByName("bridge"); err == nil { |
|
391 |
- if err = n.Delete(); err != nil { |
|
392 |
- return fmt.Errorf("could not delete the default bridge network: %v", err) |
|
393 |
- } |
|
394 |
- } |
|
395 |
- |
|
396 |
- bridgeName := bridge.DefaultBridgeName |
|
397 |
- if config.bridgeConfig.Iface != "" { |
|
398 |
- bridgeName = config.bridgeConfig.Iface |
|
399 |
- } |
|
400 |
- netOption := map[string]string{ |
|
401 |
- bridge.BridgeName: bridgeName, |
|
402 |
- bridge.DefaultBridge: strconv.FormatBool(true), |
|
403 |
- netlabel.DriverMTU: strconv.Itoa(config.Mtu), |
|
404 |
- bridge.EnableICC: strconv.FormatBool(config.bridgeConfig.InterContainerCommunication), |
|
405 |
- } |
|
406 |
- |
|
407 |
- // --ip processing |
|
408 |
- if config.bridgeConfig.DefaultIP != nil { |
|
409 |
- netOption[bridge.DefaultBindingIP] = config.bridgeConfig.DefaultIP.String() |
|
410 |
- } |
|
411 |
- |
|
412 |
- var ipamV4Conf *libnetwork.IpamConf |
|
413 |
- |
|
414 |
- ipamV4Conf = &libnetwork.IpamConf{AuxAddresses: make(map[string]string)} |
|
415 |
- |
|
416 |
- nwList, _, err := netutils.ElectInterfaceAddresses(bridgeName) |
|
417 |
- if err != nil { |
|
418 |
- return errors.Wrap(err, "list bridge addresses failed") |
|
419 |
- } |
|
420 |
- |
|
421 |
- nw := nwList[0] |
|
422 |
- if len(nwList) > 1 && config.bridgeConfig.FixedCIDR != "" { |
|
423 |
- _, fCIDR, err := net.ParseCIDR(config.bridgeConfig.FixedCIDR) |
|
424 |
- if err != nil { |
|
425 |
- return errors.Wrap(err, "parse CIDR failed") |
|
426 |
- } |
|
427 |
- // Iterate through in case there are multiple addresses for the bridge |
|
428 |
- for _, entry := range nwList { |
|
429 |
- if fCIDR.Contains(entry.IP) { |
|
430 |
- nw = entry |
|
431 |
- break |
|
432 |
- } |
|
433 |
- } |
|
434 |
- } |
|
435 |
- |
|
436 |
- ipamV4Conf.PreferredPool = lntypes.GetIPNetCanonical(nw).String() |
|
437 |
- hip, _ := lntypes.GetHostPartIP(nw.IP, nw.Mask) |
|
438 |
- if hip.IsGlobalUnicast() { |
|
439 |
- ipamV4Conf.Gateway = nw.IP.String() |
|
440 |
- } |
|
441 |
- |
|
442 |
- if config.bridgeConfig.IP != "" { |
|
443 |
- ipamV4Conf.PreferredPool = config.bridgeConfig.IP |
|
444 |
- ip, _, err := net.ParseCIDR(config.bridgeConfig.IP) |
|
445 |
- if err != nil { |
|
446 |
- return err |
|
447 |
- } |
|
448 |
- ipamV4Conf.Gateway = ip.String() |
|
449 |
- } else if bridgeName == bridge.DefaultBridgeName && ipamV4Conf.PreferredPool != "" { |
|
450 |
- logrus.Infof("Default bridge (%s) is assigned with an IP address %s. Daemon option --bip can be used to set a preferred IP address", bridgeName, ipamV4Conf.PreferredPool) |
|
451 |
- } |
|
452 |
- |
|
453 |
- if config.bridgeConfig.FixedCIDR != "" { |
|
454 |
- _, fCIDR, err := net.ParseCIDR(config.bridgeConfig.FixedCIDR) |
|
455 |
- if err != nil { |
|
456 |
- return err |
|
457 |
- } |
|
458 |
- |
|
459 |
- ipamV4Conf.SubPool = fCIDR.String() |
|
460 |
- } |
|
461 |
- |
|
462 |
- if config.bridgeConfig.DefaultGatewayIPv4 != nil { |
|
463 |
- ipamV4Conf.AuxAddresses["DefaultGatewayIPv4"] = config.bridgeConfig.DefaultGatewayIPv4.String() |
|
464 |
- } |
|
465 |
- |
|
466 |
- v4Conf := []*libnetwork.IpamConf{ipamV4Conf} |
|
467 |
- v6Conf := []*libnetwork.IpamConf{} |
|
468 |
- |
|
469 |
- // Initialize default network on "bridge" with the same name |
|
470 |
- _, err = controller.NewNetwork("bridge", "bridge", "", |
|
471 |
- libnetwork.NetworkOptionDriverOpts(netOption), |
|
472 |
- libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil), |
|
473 |
- libnetwork.NetworkOptionDeferIPv6Alloc(false)) |
|
474 |
- if err != nil { |
|
475 |
- return fmt.Errorf("Error creating default 'bridge' network: %v", err) |
|
476 |
- } |
|
477 |
- return nil |
|
478 |
-} |
|
479 |
- |
|
480 |
-// registerLinks sets up links between containers and writes the |
|
481 |
-// configuration out for persistence. |
|
482 |
-func (daemon *Daemon) registerLinks(container *container.Container, hostConfig *containertypes.HostConfig) error { |
|
483 |
- return nil |
|
484 |
-} |
|
485 |
- |
|
486 |
-func (daemon *Daemon) cleanupMounts() error { |
|
487 |
- return nil |
|
488 |
-} |
|
489 |
- |
|
490 |
-// conditionalMountOnStart is a platform specific helper function during the |
|
491 |
-// container start to call mount. |
|
492 |
-func (daemon *Daemon) conditionalMountOnStart(container *container.Container) error { |
|
493 |
- return daemon.Mount(container) |
|
494 |
-} |
|
495 |
- |
|
496 |
-// conditionalUnmountOnCleanup is a platform specific helper function called |
|
497 |
-// during the cleanup of a container to unmount. |
|
498 |
-func (daemon *Daemon) conditionalUnmountOnCleanup(container *container.Container) error { |
|
499 |
- return daemon.Unmount(container) |
|
500 |
-} |
|
501 |
- |
|
502 |
-func driverOptions(config *config.Config) []nwconfig.Option { |
|
503 |
- return []nwconfig.Option{} |
|
504 |
-} |
|
505 |
- |
|
506 |
-func (daemon *Daemon) stats(c *container.Container) (*types.StatsJSON, error) { |
|
507 |
- return nil, nil |
|
508 |
-} |
|
509 |
- |
|
510 |
-// setDefaultIsolation determine the default isolation mode for the |
|
511 |
-// daemon to run in. This is only applicable on Windows |
|
512 |
-func (daemon *Daemon) setDefaultIsolation() error { |
|
513 |
- return nil |
|
514 |
-} |
|
515 |
- |
|
516 |
-func rootFSToAPIType(rootfs *image.RootFS) types.RootFS { |
|
517 |
- return types.RootFS{} |
|
518 |
-} |
|
519 |
- |
|
520 |
-func setupDaemonProcess(config *config.Config) error { |
|
521 |
- return nil |
|
522 |
-} |
|
523 |
- |
|
524 |
-func (daemon *Daemon) setupSeccompProfile() error { |
|
525 |
- return nil |
|
526 |
-} |
|
527 |
- |
|
528 |
-func getRealPath(path string) (string, error) { |
|
529 |
- return fileutils.ReadSymlinkedDirectory(path) |
|
530 |
-} |
531 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,96 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package graphdriver |
|
4 |
- |
|
5 |
-/* |
|
6 |
-#include <sys/statvfs.h> |
|
7 |
-#include <stdlib.h> |
|
8 |
- |
|
9 |
-static inline struct statvfs *getstatfs(char *s) { |
|
10 |
- struct statvfs *buf; |
|
11 |
- int err; |
|
12 |
- buf = (struct statvfs *)malloc(sizeof(struct statvfs)); |
|
13 |
- err = statvfs(s, buf); |
|
14 |
- return buf; |
|
15 |
-} |
|
16 |
-*/ |
|
17 |
-import "C" |
|
18 |
-import ( |
|
19 |
- "path/filepath" |
|
20 |
- "unsafe" |
|
21 |
- |
|
22 |
- "github.com/docker/docker/pkg/mount" |
|
23 |
- "github.com/sirupsen/logrus" |
|
24 |
-) |
|
25 |
- |
|
26 |
-const ( |
|
27 |
- // FsMagicZfs filesystem id for Zfs |
|
28 |
- FsMagicZfs = FsMagic(0x2fc12fc1) |
|
29 |
-) |
|
30 |
- |
|
31 |
-var ( |
|
32 |
- // Slice of drivers that should be used in an order |
|
33 |
- priority = []string{ |
|
34 |
- "zfs", |
|
35 |
- } |
|
36 |
- |
|
37 |
- // FsNames maps filesystem id to name of the filesystem. |
|
38 |
- FsNames = map[FsMagic]string{ |
|
39 |
- FsMagicZfs: "zfs", |
|
40 |
- } |
|
41 |
-) |
|
42 |
- |
|
43 |
-// GetFSMagic returns the filesystem id given the path. |
|
44 |
-func GetFSMagic(rootpath string) (FsMagic, error) { |
|
45 |
- return 0, nil |
|
46 |
-} |
|
47 |
- |
|
48 |
-type fsChecker struct { |
|
49 |
- t FsMagic |
|
50 |
-} |
|
51 |
- |
|
52 |
-func (c *fsChecker) IsMounted(path string) bool { |
|
53 |
- m, _ := Mounted(c.t, path) |
|
54 |
- return m |
|
55 |
-} |
|
56 |
- |
|
57 |
-// NewFsChecker returns a checker configured for the provided FsMagic |
|
58 |
-func NewFsChecker(t FsMagic) Checker { |
|
59 |
- return &fsChecker{ |
|
60 |
- t: t, |
|
61 |
- } |
|
62 |
-} |
|
63 |
- |
|
64 |
-// NewDefaultChecker returns a check that parses /proc/mountinfo to check |
|
65 |
-// if the specified path is mounted. |
|
66 |
-// No-op on Solaris. |
|
67 |
-func NewDefaultChecker() Checker { |
|
68 |
- return &defaultChecker{} |
|
69 |
-} |
|
70 |
- |
|
71 |
-type defaultChecker struct { |
|
72 |
-} |
|
73 |
- |
|
74 |
-func (c *defaultChecker) IsMounted(path string) bool { |
|
75 |
- m, _ := mount.Mounted(path) |
|
76 |
- return m |
|
77 |
-} |
|
78 |
- |
|
79 |
-// Mounted checks if the given path is mounted as the fs type |
|
80 |
-//Solaris supports only ZFS for now |
|
81 |
-func Mounted(fsType FsMagic, mountPath string) (bool, error) { |
|
82 |
- |
|
83 |
- cs := C.CString(filepath.Dir(mountPath)) |
|
84 |
- defer C.free(unsafe.Pointer(cs)) |
|
85 |
- buf := C.getstatfs(cs) |
|
86 |
- defer C.free(unsafe.Pointer(buf)) |
|
87 |
- |
|
88 |
- // on Solaris buf.f_basetype contains ['z', 'f', 's', 0 ... ] |
|
89 |
- if (buf.f_basetype[0] != 122) || (buf.f_basetype[1] != 102) || (buf.f_basetype[2] != 115) || |
|
90 |
- (buf.f_basetype[3] != 0) { |
|
91 |
- logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", mountPath) |
|
92 |
- return false, ErrPrerequisites |
|
93 |
- } |
|
94 |
- |
|
95 |
- return true, nil |
|
96 |
-} |
97 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,58 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package zfs |
|
4 |
- |
|
5 |
-/* |
|
6 |
-#include <sys/statvfs.h> |
|
7 |
-#include <stdlib.h> |
|
8 |
- |
|
9 |
-static inline struct statvfs *getstatfs(char *s) { |
|
10 |
- struct statvfs *buf; |
|
11 |
- int err; |
|
12 |
- buf = (struct statvfs *)malloc(sizeof(struct statvfs)); |
|
13 |
- err = statvfs(s, buf); |
|
14 |
- return buf; |
|
15 |
-} |
|
16 |
-*/ |
|
17 |
-import "C" |
|
18 |
-import ( |
|
19 |
- "path/filepath" |
|
20 |
- "strings" |
|
21 |
- "unsafe" |
|
22 |
- |
|
23 |
- "github.com/docker/docker/daemon/graphdriver" |
|
24 |
- "github.com/sirupsen/logrus" |
|
25 |
-) |
|
26 |
- |
|
27 |
-func checkRootdirFs(rootdir string) error { |
|
28 |
- |
|
29 |
- cs := C.CString(filepath.Dir(rootdir)) |
|
30 |
- defer C.free(unsafe.Pointer(cs)) |
|
31 |
- buf := C.getstatfs(cs) |
|
32 |
- defer C.free(unsafe.Pointer(buf)) |
|
33 |
- |
|
34 |
- // on Solaris buf.f_basetype contains ['z', 'f', 's', 0 ... ] |
|
35 |
- if (buf.f_basetype[0] != 122) || (buf.f_basetype[1] != 102) || (buf.f_basetype[2] != 115) || |
|
36 |
- (buf.f_basetype[3] != 0) { |
|
37 |
- logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir) |
|
38 |
- return graphdriver.ErrPrerequisites |
|
39 |
- } |
|
40 |
- |
|
41 |
- return nil |
|
42 |
-} |
|
43 |
- |
|
44 |
-/* rootfs is introduced to comply with the OCI spec |
|
45 |
-which states that root filesystem must be mounted at <CID>/rootfs/ instead of <CID>/ |
|
46 |
-*/ |
|
47 |
-func getMountpoint(id string) string { |
|
48 |
- maxlen := 12 |
|
49 |
- |
|
50 |
- // we need to preserve filesystem suffix |
|
51 |
- suffix := strings.SplitN(id, "-", 2) |
|
52 |
- |
|
53 |
- if len(suffix) > 1 { |
|
54 |
- return filepath.Join(id[:maxlen]+"-"+suffix[1], "rootfs", "root") |
|
55 |
- } |
|
56 |
- |
|
57 |
- return filepath.Join(id[:maxlen], "rootfs", "root") |
|
58 |
-} |
59 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,15 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package initlayer |
|
4 |
- |
|
5 |
-import "github.com/docker/docker/pkg/containerfs" |
|
6 |
- |
|
7 |
-// Setup populates a directory with mountpoints suitable |
|
8 |
-// for bind-mounting dockerinit into the container. The mountpoint is simply an |
|
9 |
-// empty file at /.dockerinit |
|
10 |
-// |
|
11 |
-// This extra layer is used by all containers as the top-most ro layer. It protects |
|
12 |
-// the container from unwanted side-effects on the rw layer. |
|
13 |
-func Setup(initLayer containerfs.ContainerFS, rootUID, rootGID int) error { |
|
14 |
- return nil |
|
15 |
-} |
... | ... |
@@ -3,7 +3,6 @@ package daemon |
3 | 3 |
import ( |
4 | 4 |
"fmt" |
5 | 5 |
"net" |
6 |
- "runtime" |
|
7 | 6 |
"sort" |
8 | 7 |
"strings" |
9 | 8 |
"sync" |
... | ... |
@@ -452,9 +451,6 @@ func (daemon *Daemon) UpdateContainerServiceConfig(containerName string, service |
452 | 452 |
// network. If either cannot be found, an err is returned. If the |
453 | 453 |
// network cannot be set up, an err is returned. |
454 | 454 |
func (daemon *Daemon) ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error { |
455 |
- if runtime.GOOS == "solaris" { |
|
456 |
- return errors.New("docker network connect is unsupported on Solaris platform") |
|
457 |
- } |
|
458 | 455 |
container, err := daemon.GetContainer(containerName) |
459 | 456 |
if err != nil { |
460 | 457 |
return err |
... | ... |
@@ -465,9 +461,6 @@ func (daemon *Daemon) ConnectContainerToNetwork(containerName, networkName strin |
465 | 465 |
// DisconnectContainerFromNetwork disconnects the given container from |
466 | 466 |
// the given network. If either cannot be found, an err is returned. |
467 | 467 |
func (daemon *Daemon) DisconnectContainerFromNetwork(containerName string, networkName string, force bool) error { |
468 |
- if runtime.GOOS == "solaris" { |
|
469 |
- return errors.New("docker network disconnect is unsupported on Solaris platform") |
|
470 |
- } |
|
471 | 468 |
container, err := daemon.GetContainer(containerName) |
472 | 469 |
if err != nil { |
473 | 470 |
if force { |
474 | 471 |
deleted file mode 100644 |
... | ... |
@@ -1,186 +0,0 @@ |
1 |
-package daemon |
|
2 |
- |
|
3 |
-import ( |
|
4 |
- "fmt" |
|
5 |
- "sort" |
|
6 |
- "strconv" |
|
7 |
- |
|
8 |
- containertypes "github.com/docker/docker/api/types/container" |
|
9 |
- "github.com/docker/docker/container" |
|
10 |
- "github.com/docker/docker/oci" |
|
11 |
- "github.com/docker/libnetwork" |
|
12 |
- "github.com/opencontainers/runtime-spec/specs-go" |
|
13 |
-) |
|
14 |
- |
|
15 |
-func setResources(s *specs.Spec, r containertypes.Resources) error { |
|
16 |
- mem := getMemoryResources(r) |
|
17 |
- s.Solaris.CappedMemory = &mem |
|
18 |
- |
|
19 |
- capCPU := getCPUResources(r) |
|
20 |
- s.Solaris.CappedCPU = &capCPU |
|
21 |
- |
|
22 |
- return nil |
|
23 |
-} |
|
24 |
- |
|
25 |
-func setUser(s *specs.Spec, c *container.Container) error { |
|
26 |
- uid, gid, additionalGids, err := getUser(c, c.Config.User) |
|
27 |
- if err != nil { |
|
28 |
- return err |
|
29 |
- } |
|
30 |
- s.Process.User.UID = uid |
|
31 |
- s.Process.User.GID = gid |
|
32 |
- s.Process.User.AdditionalGids = additionalGids |
|
33 |
- return nil |
|
34 |
-} |
|
35 |
- |
|
36 |
-func getUser(c *container.Container, username string) (uint32, uint32, []uint32, error) { |
|
37 |
- return 0, 0, nil, nil |
|
38 |
-} |
|
39 |
- |
|
40 |
-func (daemon *Daemon) getRunzAnet(ep libnetwork.Endpoint) (specs.Anet, error) { |
|
41 |
- var ( |
|
42 |
- linkName string |
|
43 |
- lowerLink string |
|
44 |
- defRouter string |
|
45 |
- ) |
|
46 |
- |
|
47 |
- epInfo := ep.Info() |
|
48 |
- if epInfo == nil { |
|
49 |
- return specs.Anet{}, fmt.Errorf("invalid endpoint") |
|
50 |
- } |
|
51 |
- |
|
52 |
- nw, err := daemon.GetNetworkByName(ep.Network()) |
|
53 |
- if err != nil { |
|
54 |
- return specs.Anet{}, fmt.Errorf("Failed to get network %s: %v", ep.Network(), err) |
|
55 |
- } |
|
56 |
- |
|
57 |
- // Evaluate default router, linkname and lowerlink for interface endpoint |
|
58 |
- switch nw.Type() { |
|
59 |
- case "bridge": |
|
60 |
- defRouter = epInfo.Gateway().String() |
|
61 |
- linkName = "net0" // Should always be net0 for a container |
|
62 |
- |
|
63 |
- // TODO We construct lowerlink here exactly as done for solaris bridge |
|
64 |
- // initialization. Need modular code to reuse. |
|
65 |
- options := nw.Info().DriverOptions() |
|
66 |
- nwName := options["com.docker.network.bridge.name"] |
|
67 |
- lastChar := nwName[len(nwName)-1:] |
|
68 |
- if _, err = strconv.Atoi(lastChar); err != nil { |
|
69 |
- lowerLink = nwName + "_0" |
|
70 |
- } else { |
|
71 |
- lowerLink = nwName |
|
72 |
- } |
|
73 |
- |
|
74 |
- case "overlay": |
|
75 |
- defRouter = "" |
|
76 |
- linkName = "net1" |
|
77 |
- |
|
78 |
- // TODO Follows generateVxlanName() in solaris overlay. |
|
79 |
- id := nw.ID() |
|
80 |
- if len(nw.ID()) > 12 { |
|
81 |
- id = nw.ID()[:12] |
|
82 |
- } |
|
83 |
- lowerLink = "vx_" + id + "_0" |
|
84 |
- } |
|
85 |
- |
|
86 |
- runzanet := specs.Anet{ |
|
87 |
- Linkname: linkName, |
|
88 |
- Lowerlink: lowerLink, |
|
89 |
- Allowedaddr: epInfo.Iface().Address().String(), |
|
90 |
- Configallowedaddr: "true", |
|
91 |
- Defrouter: defRouter, |
|
92 |
- Linkprotection: "mac-nospoof, ip-nospoof", |
|
93 |
- Macaddress: epInfo.Iface().MacAddress().String(), |
|
94 |
- } |
|
95 |
- |
|
96 |
- return runzanet, nil |
|
97 |
-} |
|
98 |
- |
|
99 |
-func (daemon *Daemon) setNetworkInterface(s *specs.Spec, c *container.Container) error { |
|
100 |
- var anets []specs.Anet |
|
101 |
- |
|
102 |
- sb, err := daemon.netController.SandboxByID(c.NetworkSettings.SandboxID) |
|
103 |
- if err != nil { |
|
104 |
- return fmt.Errorf("Could not obtain sandbox for container") |
|
105 |
- } |
|
106 |
- |
|
107 |
- // Populate interfaces required for each endpoint |
|
108 |
- for _, ep := range sb.Endpoints() { |
|
109 |
- runzanet, err := daemon.getRunzAnet(ep) |
|
110 |
- if err != nil { |
|
111 |
- return fmt.Errorf("Failed to get interface information for endpoint %d: %v", ep.ID(), err) |
|
112 |
- } |
|
113 |
- anets = append(anets, runzanet) |
|
114 |
- } |
|
115 |
- |
|
116 |
- s.Solaris.Anet = anets |
|
117 |
- if anets != nil { |
|
118 |
- s.Solaris.Milestone = "svc:/milestone/container:default" |
|
119 |
- } |
|
120 |
- return nil |
|
121 |
-} |
|
122 |
- |
|
123 |
-func (daemon *Daemon) populateCommonSpec(s *specs.Spec, c *container.Container) error { |
|
124 |
- linkedEnv, err := daemon.setupLinkedContainers(c) |
|
125 |
- if err != nil { |
|
126 |
- return err |
|
127 |
- } |
|
128 |
- s.Root = specs.Root{ |
|
129 |
- Path: c.BaseFS.Dir(c.BaseFS.Path()), |
|
130 |
- Readonly: c.HostConfig.ReadonlyRootfs, |
|
131 |
- } |
|
132 |
- if err := c.SetupWorkingDirectory(daemon.idMappings.RootPair()); err != nil { |
|
133 |
- return err |
|
134 |
- } |
|
135 |
- cwd := c.Config.WorkingDir |
|
136 |
- s.Process.Args = append([]string{c.Path}, c.Args...) |
|
137 |
- s.Process.Cwd = cwd |
|
138 |
- s.Process.Env = c.CreateDaemonEnvironment(c.Config.Tty, linkedEnv) |
|
139 |
- s.Process.Terminal = c.Config.Tty |
|
140 |
- s.Hostname = c.FullHostname() |
|
141 |
- |
|
142 |
- return nil |
|
143 |
-} |
|
144 |
- |
|
145 |
-func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) { |
|
146 |
- s := oci.DefaultSpec() |
|
147 |
- if err := daemon.populateCommonSpec(&s, c); err != nil { |
|
148 |
- return nil, err |
|
149 |
- } |
|
150 |
- |
|
151 |
- if err := setResources(&s, c.HostConfig.Resources); err != nil { |
|
152 |
- return nil, fmt.Errorf("runtime spec resources: %v", err) |
|
153 |
- } |
|
154 |
- |
|
155 |
- if err := setUser(&s, c); err != nil { |
|
156 |
- return nil, fmt.Errorf("spec user: %v", err) |
|
157 |
- } |
|
158 |
- |
|
159 |
- if err := daemon.setNetworkInterface(&s, c); err != nil { |
|
160 |
- return nil, err |
|
161 |
- } |
|
162 |
- |
|
163 |
- if err := daemon.setupIpcDirs(c); err != nil { |
|
164 |
- return nil, err |
|
165 |
- } |
|
166 |
- |
|
167 |
- ms, err := daemon.setupMounts(c) |
|
168 |
- if err != nil { |
|
169 |
- return nil, err |
|
170 |
- } |
|
171 |
- ms = append(ms, c.IpcMounts()...) |
|
172 |
- tmpfsMounts, err := c.TmpfsMounts() |
|
173 |
- if err != nil { |
|
174 |
- return nil, err |
|
175 |
- } |
|
176 |
- ms = append(ms, tmpfsMounts...) |
|
177 |
- sort.Sort(mounts(ms)) |
|
178 |
- |
|
179 |
- return (*specs.Spec)(&s), nil |
|
180 |
-} |
|
181 |
- |
|
182 |
-// mergeUlimits merge the Ulimits from HostConfig with daemon defaults, and update HostConfig |
|
183 |
-// It will do nothing on non-Linux platform |
|
184 |
-func (daemon *Daemon) mergeUlimits(c *containertypes.HostConfig) { |
|
185 |
- return |
|
186 |
-} |
... | ... |
@@ -3,7 +3,6 @@ package daemon |
3 | 3 |
import ( |
4 | 4 |
"encoding/json" |
5 | 5 |
"errors" |
6 |
- "fmt" |
|
7 | 6 |
"runtime" |
8 | 7 |
"time" |
9 | 8 |
|
... | ... |
@@ -20,9 +19,6 @@ import ( |
20 | 20 |
// ContainerStats writes information about the container to the stream |
21 | 21 |
// given in the config object. |
22 | 22 |
func (daemon *Daemon) ContainerStats(ctx context.Context, prefixOrName string, config *backend.ContainerStatsConfig) error { |
23 |
- if runtime.GOOS == "solaris" { |
|
24 |
- return fmt.Errorf("%+v does not support stats", runtime.GOOS) |
|
25 |
- } |
|
26 | 23 |
// Engine API version (used for backwards compatibility) |
27 | 24 |
apiVersion := config.Version |
28 | 25 |
|
29 | 26 |
deleted file mode 100644 |
... | ... |
@@ -1,29 +0,0 @@ |
1 |
-package stats |
|
2 |
- |
|
3 |
-import ( |
|
4 |
- "github.com/docker/docker/container" |
|
5 |
-) |
|
6 |
- |
|
7 |
-// platformNewStatsCollector performs platform specific initialisation of the |
|
8 |
-// Collector structure. This is a no-op on Windows. |
|
9 |
-func platformNewStatsCollector(s *Collector) { |
|
10 |
-} |
|
11 |
- |
|
12 |
-// Collect registers the container with the collector and adds it to |
|
13 |
-// the event loop for collection on the specified interval returning |
|
14 |
-// a channel for the subscriber to receive on. |
|
15 |
-// Currently not supported on Solaris |
|
16 |
-func (s *Collector) Collect(c *container.Container) chan interface{} { |
|
17 |
- return nil |
|
18 |
-} |
|
19 |
- |
|
20 |
-// StopCollection closes the channels for all subscribers and removes |
|
21 |
-// the container from metrics collection. |
|
22 |
-// Currently not supported on Solaris |
|
23 |
-func (s *Collector) StopCollection(c *container.Container) { |
|
24 |
-} |
|
25 |
- |
|
26 |
-// Unsubscribe removes a specific subscriber from receiving updates for a container's stats. |
|
27 |
-// Currently not supported on Solaris |
|
28 |
-func (s *Collector) Unsubscribe(c *container.Container, ch chan interface{}) { |
|
29 |
-} |
... | ... |
@@ -95,13 +95,6 @@ if [ "$AUTO_GOPATH" ]; then |
95 | 95 |
mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")" |
96 | 96 |
ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" |
97 | 97 |
export GOPATH="${PWD}/.gopath" |
98 |
- |
|
99 |
- if [ "$(go env GOOS)" = 'solaris' ]; then |
|
100 |
- # sys/unix is installed outside the standard library on solaris |
|
101 |
- # TODO need to allow for version change, need to get version from go |
|
102 |
- export GO_VERSION=${GO_VERSION:-"1.8.1"} |
|
103 |
- export GOPATH="${GOPATH}:/usr/lib/gocode/${GO_VERSION}" |
|
104 |
- fi |
|
105 | 98 |
fi |
106 | 99 |
|
107 | 100 |
if [ ! "$GOPATH" ]; then |
... | ... |
@@ -17,9 +17,6 @@ BUILDFLAGS=( -tags "netgo seccomp libdm_no_deferred_remove" ) |
17 | 17 |
TESTDIRS="${TESTDIRS:-"./..."}" |
18 | 18 |
|
19 | 19 |
exclude_paths="/vendor/|/integration" |
20 |
-if [ "$(go env GOHOSTOS)" = 'solaris' ]; then |
|
21 |
- exclude_paths="$exclude_paths|/daemon/graphdriver" |
|
22 |
-fi |
|
23 | 20 |
pkg_list=$(go list $TESTDIRS | grep -vE "($exclude_paths)") |
24 | 21 |
|
25 | 22 |
go test -cover "${BUILDFLAGS[@]}" $TESTFLAGS $pkg_list |
... | ... |
@@ -39,11 +39,8 @@ func DefaultSpec() specs.Spec { |
39 | 39 |
func DefaultOSSpec(osName string) specs.Spec { |
40 | 40 |
if osName == "windows" { |
41 | 41 |
return DefaultWindowsSpec() |
42 |
- } else if osName == "solaris" { |
|
43 |
- return DefaultSolarisSpec() |
|
44 |
- } else { |
|
45 |
- return DefaultLinuxSpec() |
|
46 | 42 |
} |
43 |
+ return DefaultLinuxSpec() |
|
47 | 44 |
} |
48 | 45 |
|
49 | 46 |
// DefaultWindowsSpec create a default spec for running Windows containers |
... | ... |
@@ -56,15 +53,6 @@ func DefaultWindowsSpec() specs.Spec { |
56 | 56 |
} |
57 | 57 |
} |
58 | 58 |
|
59 |
-// DefaultSolarisSpec create a default spec for running Solaris containers |
|
60 |
-func DefaultSolarisSpec() specs.Spec { |
|
61 |
- s := specs.Spec{ |
|
62 |
- Version: "0.6.0", |
|
63 |
- } |
|
64 |
- s.Solaris = &specs.Solaris{} |
|
65 |
- return s |
|
66 |
-} |
|
67 |
- |
|
68 | 59 |
// DefaultLinuxSpec create a default spec for running Linux containers |
69 | 60 |
func DefaultLinuxSpec() specs.Spec { |
70 | 61 |
s := specs.Spec{ |
... | ... |
@@ -72,12 +72,7 @@ func TestIsArchivePathInvalidFile(t *testing.T) { |
72 | 72 |
} |
73 | 73 |
|
74 | 74 |
func TestIsArchivePathTar(t *testing.T) { |
75 |
- var whichTar string |
|
76 |
- if runtime.GOOS == "solaris" { |
|
77 |
- whichTar = "gtar" |
|
78 |
- } else { |
|
79 |
- whichTar = "tar" |
|
80 |
- } |
|
75 |
+ whichTar := "tar" |
|
81 | 76 |
cmdStr := fmt.Sprintf("touch /tmp/archivedata && %s -cf /tmp/archive /tmp/archivedata && gzip --stdout /tmp/archive > /tmp/archive.gz", whichTar) |
82 | 77 |
cmd := exec.Command("sh", "-c", cmdStr) |
83 | 78 |
output, err := cmd.CombinedOutput() |
... | ... |
@@ -8,7 +8,6 @@ import ( |
8 | 8 |
"io/ioutil" |
9 | 9 |
"os" |
10 | 10 |
"path/filepath" |
11 |
- "runtime" |
|
12 | 11 |
"strings" |
13 | 12 |
"syscall" |
14 | 13 |
"testing" |
... | ... |
@@ -224,9 +223,6 @@ func TestTarWithBlockCharFifo(t *testing.T) { |
224 | 224 |
|
225 | 225 |
// TestTarUntarWithXattr is Unix as Lsetxattr is not supported on Windows |
226 | 226 |
func TestTarUntarWithXattr(t *testing.T) { |
227 |
- if runtime.GOOS == "solaris" { |
|
228 |
- t.Skip() |
|
229 |
- } |
|
230 | 227 |
origin, err := ioutil.TempDir("", "docker-test-untar-origin") |
231 | 228 |
require.NoError(t, err) |
232 | 229 |
defer os.RemoveAll(origin) |
... | ... |
@@ -7,16 +7,11 @@ import ( |
7 | 7 |
"io/ioutil" |
8 | 8 |
"os" |
9 | 9 |
"path" |
10 |
- "runtime" |
|
11 | 10 |
"sort" |
12 | 11 |
"testing" |
13 | 12 |
) |
14 | 13 |
|
15 | 14 |
func TestHardLinkOrder(t *testing.T) { |
16 |
- //TODO Should run for Solaris |
|
17 |
- if runtime.GOOS == "solaris" { |
|
18 |
- t.Skip("gcp failures on Solaris") |
|
19 |
- } |
|
20 | 15 |
names := []string{"file1.txt", "file2.txt", "file3.txt"} |
21 | 16 |
msg := []byte("Hey y'all") |
22 | 17 |
|
... | ... |
@@ -22,15 +22,7 @@ func max(x, y int) int { |
22 | 22 |
} |
23 | 23 |
|
24 | 24 |
func copyDir(src, dst string) error { |
25 |
- cmd := exec.Command("cp", "-a", src, dst) |
|
26 |
- if runtime.GOOS == "solaris" { |
|
27 |
- cmd = exec.Command("gcp", "-a", src, dst) |
|
28 |
- } |
|
29 |
- |
|
30 |
- if err := cmd.Run(); err != nil { |
|
31 |
- return err |
|
32 |
- } |
|
33 |
- return nil |
|
25 |
+ return exec.Command("cp", "-a", src, dst).Run() |
|
34 | 26 |
} |
35 | 27 |
|
36 | 28 |
type FileType uint32 |
... | ... |
@@ -247,9 +239,8 @@ func TestChangesWithChangesGH13590(t *testing.T) { |
247 | 247 |
func TestChangesDirsEmpty(t *testing.T) { |
248 | 248 |
// TODO Windows. There may be a way of running this, but turning off for now |
249 | 249 |
// as createSampleDir uses symlinks. |
250 |
- // TODO Should work for Solaris |
|
251 |
- if runtime.GOOS == "windows" || runtime.GOOS == "solaris" { |
|
252 |
- t.Skip("symlinks on Windows; gcp failure on Solaris") |
|
250 |
+ if runtime.GOOS == "windows" { |
|
251 |
+ t.Skip("symlinks on Windows") |
|
253 | 252 |
} |
254 | 253 |
src, err := ioutil.TempDir("", "docker-changes-test") |
255 | 254 |
require.NoError(t, err) |
... | ... |
@@ -335,9 +326,8 @@ func mutateSampleDir(t *testing.T, root string) { |
335 | 335 |
func TestChangesDirsMutated(t *testing.T) { |
336 | 336 |
// TODO Windows. There may be a way of running this, but turning off for now |
337 | 337 |
// as createSampleDir uses symlinks. |
338 |
- // TODO Should work for Solaris |
|
339 |
- if runtime.GOOS == "windows" || runtime.GOOS == "solaris" { |
|
340 |
- t.Skip("symlinks on Windows; gcp failures on Solaris") |
|
338 |
+ if runtime.GOOS == "windows" { |
|
339 |
+ t.Skip("symlinks on Windows") |
|
341 | 340 |
} |
342 | 341 |
src, err := ioutil.TempDir("", "docker-changes-test") |
343 | 342 |
require.NoError(t, err) |
... | ... |
@@ -392,9 +382,8 @@ func TestChangesDirsMutated(t *testing.T) { |
392 | 392 |
func TestApplyLayer(t *testing.T) { |
393 | 393 |
// TODO Windows. There may be a way of running this, but turning off for now |
394 | 394 |
// as createSampleDir uses symlinks. |
395 |
- // TODO Should work for Solaris |
|
396 |
- if runtime.GOOS == "windows" || runtime.GOOS == "solaris" { |
|
397 |
- t.Skip("symlinks on Windows; gcp failures on Solaris") |
|
395 |
+ if runtime.GOOS == "windows" { |
|
396 |
+ t.Skip("symlinks on Windows") |
|
398 | 397 |
} |
399 | 398 |
src, err := ioutil.TempDir("", "docker-changes-test") |
400 | 399 |
require.NoError(t, err) |
... | ... |
@@ -197,8 +197,8 @@ func TestChrootTarUntarWithSymlink(t *testing.T) { |
197 | 197 |
|
198 | 198 |
func TestChrootCopyWithTar(t *testing.T) { |
199 | 199 |
// TODO Windows: Figure out why this is failing |
200 |
- if runtime.GOOS == "windows" || runtime.GOOS == "solaris" { |
|
201 |
- t.Skip("Failing on Windows and Solaris") |
|
200 |
+ if runtime.GOOS == "windows" { |
|
201 |
+ t.Skip("Failing on Windows") |
|
202 | 202 |
} |
203 | 203 |
tmpdir, err := ioutil.TempDir("", "docker-TestChrootCopyWithTar") |
204 | 204 |
if err != nil { |
8 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,34 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package mount |
|
4 |
- |
|
5 |
-import ( |
|
6 |
- "unsafe" |
|
7 |
- |
|
8 |
- "golang.org/x/sys/unix" |
|
9 |
-) |
|
10 |
- |
|
11 |
-// #include <stdlib.h> |
|
12 |
-// #include <stdio.h> |
|
13 |
-// #include <sys/mount.h> |
|
14 |
-// int Mount(const char *spec, const char *dir, int mflag, |
|
15 |
-// char *fstype, char *dataptr, int datalen, char *optptr, int optlen) { |
|
16 |
-// return mount(spec, dir, mflag, fstype, dataptr, datalen, optptr, optlen); |
|
17 |
-// } |
|
18 |
-import "C" |
|
19 |
- |
|
20 |
-func mount(device, target, mType string, flag uintptr, data string) error { |
|
21 |
- spec := C.CString(device) |
|
22 |
- dir := C.CString(target) |
|
23 |
- fstype := C.CString(mType) |
|
24 |
- _, err := C.Mount(spec, dir, C.int(flag), fstype, nil, 0, nil, 0) |
|
25 |
- C.free(unsafe.Pointer(spec)) |
|
26 |
- C.free(unsafe.Pointer(dir)) |
|
27 |
- C.free(unsafe.Pointer(fstype)) |
|
28 |
- return err |
|
29 |
-} |
|
30 |
- |
|
31 |
-func unmount(target string, flag int) error { |
|
32 |
- err := unix.Unmount(target, flag) |
|
33 |
- return err |
|
34 |
-} |
35 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,44 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package mount |
|
4 |
- |
|
5 |
-/* |
|
6 |
-#include <stdio.h> |
|
7 |
-#include <stdlib.h> |
|
8 |
-#include <sys/mnttab.h> |
|
9 |
-*/ |
|
10 |
-import "C" |
|
11 |
- |
|
12 |
-import ( |
|
13 |
- "fmt" |
|
14 |
- "unsafe" |
|
15 |
-) |
|
16 |
- |
|
17 |
-func parseMountTable() ([]*Info, error) { |
|
18 |
- path := C.CString(C.MNTTAB) |
|
19 |
- defer C.free(unsafe.Pointer(path)) |
|
20 |
- mode := C.CString("r") |
|
21 |
- defer C.free(unsafe.Pointer(mode)) |
|
22 |
- |
|
23 |
- mnttab := C.fopen(path, mode) |
|
24 |
- if mnttab == nil { |
|
25 |
- return nil, fmt.Errorf("Failed to open %s", C.MNTTAB) |
|
26 |
- } |
|
27 |
- |
|
28 |
- var out []*Info |
|
29 |
- var mp C.struct_mnttab |
|
30 |
- |
|
31 |
- ret := C.getmntent(mnttab, &mp) |
|
32 |
- for ret == 0 { |
|
33 |
- var mountinfo Info |
|
34 |
- mountinfo.Mountpoint = C.GoString(mp.mnt_mountp) |
|
35 |
- mountinfo.Source = C.GoString(mp.mnt_special) |
|
36 |
- mountinfo.Fstype = C.GoString(mp.mnt_fstype) |
|
37 |
- mountinfo.Opts = C.GoString(mp.mnt_mntopts) |
|
38 |
- out = append(out, &mountinfo) |
|
39 |
- ret = C.getmntent(mnttab, &mp) |
|
40 |
- } |
|
41 |
- |
|
42 |
- C.fclose(mnttab) |
|
43 |
- return out, nil |
|
44 |
-} |
45 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,58 +0,0 @@ |
1 |
-// +build solaris |
|
2 |
- |
|
3 |
-package mount |
|
4 |
- |
|
5 |
-// MakeShared ensures a mounted filesystem has the SHARED mount option enabled. |
|
6 |
-// See the supported options in flags.go for further reference. |
|
7 |
-func MakeShared(mountPoint string) error { |
|
8 |
- return ensureMountedAs(mountPoint, "shared") |
|
9 |
-} |
|
10 |
- |
|
11 |
-// MakeRShared ensures a mounted filesystem has the RSHARED mount option enabled. |
|
12 |
-// See the supported options in flags.go for further reference. |
|
13 |
-func MakeRShared(mountPoint string) error { |
|
14 |
- return ensureMountedAs(mountPoint, "rshared") |
|
15 |
-} |
|
16 |
- |
|
17 |
-// MakePrivate ensures a mounted filesystem has the PRIVATE mount option enabled. |
|
18 |
-// See the supported options in flags.go for further reference. |
|
19 |
-func MakePrivate(mountPoint string) error { |
|
20 |
- return ensureMountedAs(mountPoint, "private") |
|
21 |
-} |
|
22 |
- |
|
23 |
-// MakeRPrivate ensures a mounted filesystem has the RPRIVATE mount option |
|
24 |
-// enabled. See the supported options in flags.go for further reference. |
|
25 |
-func MakeRPrivate(mountPoint string) error { |
|
26 |
- return ensureMountedAs(mountPoint, "rprivate") |
|
27 |
-} |
|
28 |
- |
|
29 |
-// MakeSlave ensures a mounted filesystem has the SLAVE mount option enabled. |
|
30 |
-// See the supported options in flags.go for further reference. |
|
31 |
-func MakeSlave(mountPoint string) error { |
|
32 |
- return ensureMountedAs(mountPoint, "slave") |
|
33 |
-} |
|
34 |
- |
|
35 |
-// MakeRSlave ensures a mounted filesystem has the RSLAVE mount option enabled. |
|
36 |
-// See the supported options in flags.go for further reference. |
|
37 |
-func MakeRSlave(mountPoint string) error { |
|
38 |
- return ensureMountedAs(mountPoint, "rslave") |
|
39 |
-} |
|
40 |
- |
|
41 |
-// MakeUnbindable ensures a mounted filesystem has the UNBINDABLE mount option |
|
42 |
-// enabled. See the supported options in flags.go for further reference. |
|
43 |
-func MakeUnbindable(mountPoint string) error { |
|
44 |
- return ensureMountedAs(mountPoint, "unbindable") |
|
45 |
-} |
|
46 |
- |
|
47 |
-// MakeRUnbindable ensures a mounted filesystem has the RUNBINDABLE mount |
|
48 |
-// option enabled. See the supported options in flags.go for further reference. |
|
49 |
-func MakeRUnbindable(mountPoint string) error { |
|
50 |
- return ensureMountedAs(mountPoint, "runbindable") |
|
51 |
-} |
|
52 |
- |
|
53 |
-func ensureMountedAs(mountPoint, options string) error { |
|
54 |
- // TODO: Solaris does not support bind mounts. |
|
55 |
- // Evaluate lofs and also look at the relevant |
|
56 |
- // mount flags to be supported. |
|
57 |
- return nil |
|
58 |
-} |
59 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,37 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package operatingsystem |
|
4 |
- |
|
5 |
-/* |
|
6 |
-#include <zone.h> |
|
7 |
-*/ |
|
8 |
-import "C" |
|
9 |
- |
|
10 |
-import ( |
|
11 |
- "bytes" |
|
12 |
- "errors" |
|
13 |
- "io/ioutil" |
|
14 |
-) |
|
15 |
- |
|
16 |
-var etcOsRelease = "/etc/release" |
|
17 |
- |
|
18 |
-// GetOperatingSystem gets the name of the current operating system. |
|
19 |
-func GetOperatingSystem() (string, error) { |
|
20 |
- b, err := ioutil.ReadFile(etcOsRelease) |
|
21 |
- if err != nil { |
|
22 |
- return "", err |
|
23 |
- } |
|
24 |
- if i := bytes.Index(b, []byte("\n")); i >= 0 { |
|
25 |
- b = bytes.Trim(b[:i], " ") |
|
26 |
- return string(b), nil |
|
27 |
- } |
|
28 |
- return "", errors.New("release not found") |
|
29 |
-} |
|
30 |
- |
|
31 |
-// IsContainerized returns true if we are running inside a container. |
|
32 |
-func IsContainerized() (bool, error) { |
|
33 |
- if C.getzoneid() != 0 { |
|
34 |
- return true, nil |
|
35 |
- } |
|
36 |
- return false, nil |
|
37 |
-} |
38 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,42 +0,0 @@ |
1 |
-package signal |
|
2 |
- |
|
3 |
-import ( |
|
4 |
- "syscall" |
|
5 |
-) |
|
6 |
- |
|
7 |
-// SignalMap is a map of Solaris signals. |
|
8 |
-// SIGINFO and SIGTHR not defined for Solaris |
|
9 |
-var SignalMap = map[string]syscall.Signal{ |
|
10 |
- "ABRT": syscall.SIGABRT, |
|
11 |
- "ALRM": syscall.SIGALRM, |
|
12 |
- "BUF": syscall.SIGBUS, |
|
13 |
- "CHLD": syscall.SIGCHLD, |
|
14 |
- "CONT": syscall.SIGCONT, |
|
15 |
- "EMT": syscall.SIGEMT, |
|
16 |
- "FPE": syscall.SIGFPE, |
|
17 |
- "HUP": syscall.SIGHUP, |
|
18 |
- "ILL": syscall.SIGILL, |
|
19 |
- "INT": syscall.SIGINT, |
|
20 |
- "IO": syscall.SIGIO, |
|
21 |
- "IOT": syscall.SIGIOT, |
|
22 |
- "KILL": syscall.SIGKILL, |
|
23 |
- "LWP": syscall.SIGLWP, |
|
24 |
- "PIPE": syscall.SIGPIPE, |
|
25 |
- "PROF": syscall.SIGPROF, |
|
26 |
- "QUIT": syscall.SIGQUIT, |
|
27 |
- "SEGV": syscall.SIGSEGV, |
|
28 |
- "STOP": syscall.SIGSTOP, |
|
29 |
- "SYS": syscall.SIGSYS, |
|
30 |
- "TERM": syscall.SIGTERM, |
|
31 |
- "TRAP": syscall.SIGTRAP, |
|
32 |
- "TSTP": syscall.SIGTSTP, |
|
33 |
- "TTIN": syscall.SIGTTIN, |
|
34 |
- "TTOU": syscall.SIGTTOU, |
|
35 |
- "URG": syscall.SIGURG, |
|
36 |
- "USR1": syscall.SIGUSR1, |
|
37 |
- "USR2": syscall.SIGUSR2, |
|
38 |
- "VTALRM": syscall.SIGVTALRM, |
|
39 |
- "WINCH": syscall.SIGWINCH, |
|
40 |
- "XCPU": syscall.SIGXCPU, |
|
41 |
- "XFSZ": syscall.SIGXFSZ, |
|
42 |
-} |
43 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,121 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package sysinfo |
|
4 |
- |
|
5 |
-import ( |
|
6 |
- "bytes" |
|
7 |
- "os/exec" |
|
8 |
- "strconv" |
|
9 |
- "strings" |
|
10 |
-) |
|
11 |
- |
|
12 |
-/* |
|
13 |
-#cgo LDFLAGS: -llgrp |
|
14 |
-#include <unistd.h> |
|
15 |
-#include <stdlib.h> |
|
16 |
-#include <sys/lgrp_user.h> |
|
17 |
-int getLgrpCount() { |
|
18 |
- lgrp_cookie_t lgrpcookie = LGRP_COOKIE_NONE; |
|
19 |
- uint_t nlgrps; |
|
20 |
- |
|
21 |
- if ((lgrpcookie = lgrp_init(LGRP_VIEW_OS)) == LGRP_COOKIE_NONE) { |
|
22 |
- return -1; |
|
23 |
- } |
|
24 |
- nlgrps = lgrp_nlgrps(lgrpcookie); |
|
25 |
- return nlgrps; |
|
26 |
-} |
|
27 |
-*/ |
|
28 |
-import "C" |
|
29 |
- |
|
30 |
-// IsCPUSharesAvailable returns whether CPUShares setting is supported. |
|
31 |
-// We need FSS to be set as default scheduling class to support CPU Shares |
|
32 |
-func IsCPUSharesAvailable() bool { |
|
33 |
- cmd := exec.Command("/usr/sbin/dispadmin", "-d") |
|
34 |
- outBuf := new(bytes.Buffer) |
|
35 |
- errBuf := new(bytes.Buffer) |
|
36 |
- cmd.Stderr = errBuf |
|
37 |
- cmd.Stdout = outBuf |
|
38 |
- |
|
39 |
- if err := cmd.Run(); err != nil { |
|
40 |
- return false |
|
41 |
- } |
|
42 |
- return (strings.Contains(outBuf.String(), "FSS")) |
|
43 |
-} |
|
44 |
- |
|
45 |
-// New returns a new SysInfo, using the filesystem to detect which features |
|
46 |
-// the kernel supports. |
|
47 |
-//NOTE Solaris: If we change the below capabilities be sure |
|
48 |
-// to update verifyPlatformContainerSettings() in daemon_solaris.go |
|
49 |
-func New(quiet bool) *SysInfo { |
|
50 |
- sysInfo := &SysInfo{} |
|
51 |
- sysInfo.cgroupMemInfo = setCgroupMem(quiet) |
|
52 |
- sysInfo.cgroupCPUInfo = setCgroupCPU(quiet) |
|
53 |
- sysInfo.cgroupBlkioInfo = setCgroupBlkioInfo(quiet) |
|
54 |
- sysInfo.cgroupCpusetInfo = setCgroupCPUsetInfo(quiet) |
|
55 |
- |
|
56 |
- sysInfo.IPv4ForwardingDisabled = false |
|
57 |
- |
|
58 |
- sysInfo.AppArmor = false |
|
59 |
- |
|
60 |
- return sysInfo |
|
61 |
-} |
|
62 |
- |
|
63 |
-// setCgroupMem reads the memory information for Solaris. |
|
64 |
-func setCgroupMem(quiet bool) cgroupMemInfo { |
|
65 |
- |
|
66 |
- return cgroupMemInfo{ |
|
67 |
- MemoryLimit: true, |
|
68 |
- SwapLimit: true, |
|
69 |
- MemoryReservation: false, |
|
70 |
- OomKillDisable: false, |
|
71 |
- MemorySwappiness: false, |
|
72 |
- KernelMemory: false, |
|
73 |
- } |
|
74 |
-} |
|
75 |
- |
|
76 |
-// setCgroupCPU reads the cpu information for Solaris. |
|
77 |
-func setCgroupCPU(quiet bool) cgroupCPUInfo { |
|
78 |
- |
|
79 |
- return cgroupCPUInfo{ |
|
80 |
- CPUShares: true, |
|
81 |
- CPUCfsPeriod: false, |
|
82 |
- CPUCfsQuota: true, |
|
83 |
- CPURealtimePeriod: false, |
|
84 |
- CPURealtimeRuntime: false, |
|
85 |
- } |
|
86 |
-} |
|
87 |
- |
|
88 |
-// blkio switches are not supported in Solaris. |
|
89 |
-func setCgroupBlkioInfo(quiet bool) cgroupBlkioInfo { |
|
90 |
- |
|
91 |
- return cgroupBlkioInfo{ |
|
92 |
- BlkioWeight: false, |
|
93 |
- BlkioWeightDevice: false, |
|
94 |
- } |
|
95 |
-} |
|
96 |
- |
|
97 |
-// setCgroupCPUsetInfo reads the cpuset information for Solaris. |
|
98 |
-func setCgroupCPUsetInfo(quiet bool) cgroupCpusetInfo { |
|
99 |
- |
|
100 |
- return cgroupCpusetInfo{ |
|
101 |
- Cpuset: true, |
|
102 |
- Cpus: getCPUCount(), |
|
103 |
- Mems: getLgrpCount(), |
|
104 |
- } |
|
105 |
-} |
|
106 |
- |
|
107 |
-func getCPUCount() string { |
|
108 |
- ncpus := C.sysconf(C._SC_NPROCESSORS_ONLN) |
|
109 |
- if ncpus <= 0 { |
|
110 |
- return "" |
|
111 |
- } |
|
112 |
- return strconv.FormatInt(int64(ncpus), 16) |
|
113 |
-} |
|
114 |
- |
|
115 |
-func getLgrpCount() string { |
|
116 |
- nlgrps := C.getLgrpCount() |
|
117 |
- if nlgrps <= 0 { |
|
118 |
- return "" |
|
119 |
- } |
|
120 |
- return strconv.FormatInt(int64(nlgrps), 16) |
|
121 |
-} |
122 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,129 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package system |
|
4 |
- |
|
5 |
-import ( |
|
6 |
- "fmt" |
|
7 |
- "unsafe" |
|
8 |
-) |
|
9 |
- |
|
10 |
-// #cgo CFLAGS: -std=c99 |
|
11 |
-// #cgo LDFLAGS: -lkstat |
|
12 |
-// #include <unistd.h> |
|
13 |
-// #include <stdlib.h> |
|
14 |
-// #include <stdio.h> |
|
15 |
-// #include <kstat.h> |
|
16 |
-// #include <sys/swap.h> |
|
17 |
-// #include <sys/param.h> |
|
18 |
-// struct swaptable *allocSwaptable(int num) { |
|
19 |
-// struct swaptable *st; |
|
20 |
-// struct swapent *swapent; |
|
21 |
-// st = (struct swaptable *)malloc(num * sizeof(swapent_t) + sizeof (int)); |
|
22 |
-// swapent = st->swt_ent; |
|
23 |
-// for (int i = 0; i < num; i++,swapent++) { |
|
24 |
-// swapent->ste_path = (char *)malloc(MAXPATHLEN * sizeof (char)); |
|
25 |
-// } |
|
26 |
-// st->swt_n = num; |
|
27 |
-// return st; |
|
28 |
-//} |
|
29 |
-// void freeSwaptable (struct swaptable *st) { |
|
30 |
-// struct swapent *swapent = st->swt_ent; |
|
31 |
-// for (int i = 0; i < st->swt_n; i++,swapent++) { |
|
32 |
-// free(swapent->ste_path); |
|
33 |
-// } |
|
34 |
-// free(st); |
|
35 |
-// } |
|
36 |
-// swapent_t getSwapEnt(swapent_t *ent, int i) { |
|
37 |
-// return ent[i]; |
|
38 |
-// } |
|
39 |
-// int64_t getPpKernel() { |
|
40 |
-// int64_t pp_kernel = 0; |
|
41 |
-// kstat_ctl_t *ksc; |
|
42 |
-// kstat_t *ks; |
|
43 |
-// kstat_named_t *knp; |
|
44 |
-// kid_t kid; |
|
45 |
-// |
|
46 |
-// if ((ksc = kstat_open()) == NULL) { |
|
47 |
-// return -1; |
|
48 |
-// } |
|
49 |
-// if ((ks = kstat_lookup(ksc, "unix", 0, "system_pages")) == NULL) { |
|
50 |
-// return -1; |
|
51 |
-// } |
|
52 |
-// if (((kid = kstat_read(ksc, ks, NULL)) == -1) || |
|
53 |
-// ((knp = kstat_data_lookup(ks, "pp_kernel")) == NULL)) { |
|
54 |
-// return -1; |
|
55 |
-// } |
|
56 |
-// switch (knp->data_type) { |
|
57 |
-// case KSTAT_DATA_UINT64: |
|
58 |
-// pp_kernel = knp->value.ui64; |
|
59 |
-// break; |
|
60 |
-// case KSTAT_DATA_UINT32: |
|
61 |
-// pp_kernel = knp->value.ui32; |
|
62 |
-// break; |
|
63 |
-// } |
|
64 |
-// pp_kernel *= sysconf(_SC_PAGESIZE); |
|
65 |
-// return (pp_kernel > 0 ? pp_kernel : -1); |
|
66 |
-// } |
|
67 |
-import "C" |
|
68 |
- |
|
69 |
-// Get the system memory info using sysconf same as prtconf |
|
70 |
-func getTotalMem() int64 { |
|
71 |
- pagesize := C.sysconf(C._SC_PAGESIZE) |
|
72 |
- npages := C.sysconf(C._SC_PHYS_PAGES) |
|
73 |
- return int64(pagesize * npages) |
|
74 |
-} |
|
75 |
- |
|
76 |
-func getFreeMem() int64 { |
|
77 |
- pagesize := C.sysconf(C._SC_PAGESIZE) |
|
78 |
- npages := C.sysconf(C._SC_AVPHYS_PAGES) |
|
79 |
- return int64(pagesize * npages) |
|
80 |
-} |
|
81 |
- |
|
82 |
-// ReadMemInfo retrieves memory statistics of the host system and returns a |
|
83 |
-// MemInfo type. |
|
84 |
-func ReadMemInfo() (*MemInfo, error) { |
|
85 |
- |
|
86 |
- ppKernel := C.getPpKernel() |
|
87 |
- MemTotal := getTotalMem() |
|
88 |
- MemFree := getFreeMem() |
|
89 |
- SwapTotal, SwapFree, err := getSysSwap() |
|
90 |
- |
|
91 |
- if ppKernel < 0 || MemTotal < 0 || MemFree < 0 || SwapTotal < 0 || |
|
92 |
- SwapFree < 0 { |
|
93 |
- return nil, fmt.Errorf("error getting system memory info %v\n", err) |
|
94 |
- } |
|
95 |
- |
|
96 |
- meminfo := &MemInfo{} |
|
97 |
- // Total memory is total physical memory less than memory locked by kernel |
|
98 |
- meminfo.MemTotal = MemTotal - int64(ppKernel) |
|
99 |
- meminfo.MemFree = MemFree |
|
100 |
- meminfo.SwapTotal = SwapTotal |
|
101 |
- meminfo.SwapFree = SwapFree |
|
102 |
- |
|
103 |
- return meminfo, nil |
|
104 |
-} |
|
105 |
- |
|
106 |
-func getSysSwap() (int64, int64, error) { |
|
107 |
- var tSwap int64 |
|
108 |
- var fSwap int64 |
|
109 |
- var diskblksPerPage int64 |
|
110 |
- num, err := C.swapctl(C.SC_GETNSWP, nil) |
|
111 |
- if err != nil { |
|
112 |
- return -1, -1, err |
|
113 |
- } |
|
114 |
- st := C.allocSwaptable(num) |
|
115 |
- _, err = C.swapctl(C.SC_LIST, unsafe.Pointer(st)) |
|
116 |
- if err != nil { |
|
117 |
- C.freeSwaptable(st) |
|
118 |
- return -1, -1, err |
|
119 |
- } |
|
120 |
- |
|
121 |
- diskblksPerPage = int64(C.sysconf(C._SC_PAGESIZE) >> C.DEV_BSHIFT) |
|
122 |
- for i := 0; i < int(num); i++ { |
|
123 |
- swapent := C.getSwapEnt(&st.swt_ent[0], C.int(i)) |
|
124 |
- tSwap += int64(swapent.ste_pages) * diskblksPerPage |
|
125 |
- fSwap += int64(swapent.ste_free) * diskblksPerPage |
|
126 |
- } |
|
127 |
- C.freeSwaptable(st) |
|
128 |
- return tSwap, fSwap, nil |
|
129 |
-} |
130 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,65 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package term |
|
4 |
- |
|
5 |
-import ( |
|
6 |
- "syscall" |
|
7 |
- "unsafe" |
|
8 |
- |
|
9 |
- "golang.org/x/sys/unix" |
|
10 |
-) |
|
11 |
- |
|
12 |
-// #include <termios.h> |
|
13 |
-import "C" |
|
14 |
- |
|
15 |
-// Termios is the Unix API for terminal I/O. |
|
16 |
-// It is passthrough for unix.Termios in order to make it portable with |
|
17 |
-// other platforms where it is not available or handled differently. |
|
18 |
-type Termios unix.Termios |
|
19 |
- |
|
20 |
-// MakeRaw put the terminal connected to the given file descriptor into raw |
|
21 |
-// mode and returns the previous state of the terminal so that it can be |
|
22 |
-// restored. |
|
23 |
-func MakeRaw(fd uintptr) (*State, error) { |
|
24 |
- var oldState State |
|
25 |
- if err := tcget(fd, &oldState.termios); err != 0 { |
|
26 |
- return nil, err |
|
27 |
- } |
|
28 |
- |
|
29 |
- newState := oldState.termios |
|
30 |
- |
|
31 |
- newState.Iflag &^= (unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON | unix.IXANY) |
|
32 |
- newState.Oflag &^= unix.OPOST |
|
33 |
- newState.Lflag &^= (unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN) |
|
34 |
- newState.Cflag &^= (unix.CSIZE | unix.PARENB) |
|
35 |
- newState.Cflag |= unix.CS8 |
|
36 |
- |
|
37 |
- /* |
|
38 |
- VMIN is the minimum number of characters that needs to be read in non-canonical mode for it to be returned |
|
39 |
- Since VMIN is overloaded with another element in canonical mode when we switch modes it defaults to 4. It |
|
40 |
- needs to be explicitly set to 1. |
|
41 |
- */ |
|
42 |
- newState.Cc[C.VMIN] = 1 |
|
43 |
- newState.Cc[C.VTIME] = 0 |
|
44 |
- |
|
45 |
- if err := tcset(fd, &newState); err != 0 { |
|
46 |
- return nil, err |
|
47 |
- } |
|
48 |
- return &oldState, nil |
|
49 |
-} |
|
50 |
- |
|
51 |
-func tcget(fd uintptr, p *Termios) syscall.Errno { |
|
52 |
- ret, err := C.tcgetattr(C.int(fd), (*C.struct_termios)(unsafe.Pointer(p))) |
|
53 |
- if ret != 0 { |
|
54 |
- return err.(syscall.Errno) |
|
55 |
- } |
|
56 |
- return 0 |
|
57 |
-} |
|
58 |
- |
|
59 |
-func tcset(fd uintptr, p *Termios) syscall.Errno { |
|
60 |
- ret, err := C.tcsetattr(C.int(fd), C.TCSANOW, (*C.struct_termios)(unsafe.Pointer(p))) |
|
61 |
- if ret != 0 { |
|
62 |
- return err.(syscall.Errno) |
|
63 |
- } |
|
64 |
- return 0 |
|
65 |
-} |
66 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,42 +0,0 @@ |
1 |
-// +build solaris,cgo |
|
2 |
- |
|
3 |
-package term |
|
4 |
- |
|
5 |
-import ( |
|
6 |
- "unsafe" |
|
7 |
- |
|
8 |
- "golang.org/x/sys/unix" |
|
9 |
-) |
|
10 |
- |
|
11 |
-/* |
|
12 |
-#include <unistd.h> |
|
13 |
-#include <stropts.h> |
|
14 |
-#include <termios.h> |
|
15 |
- |
|
16 |
-// Small wrapper to get rid of variadic args of ioctl() |
|
17 |
-int my_ioctl(int fd, int cmd, struct winsize *ws) { |
|
18 |
- return ioctl(fd, cmd, ws); |
|
19 |
-} |
|
20 |
-*/ |
|
21 |
-import "C" |
|
22 |
- |
|
23 |
-// GetWinsize returns the window size based on the specified file descriptor. |
|
24 |
-func GetWinsize(fd uintptr) (*Winsize, error) { |
|
25 |
- ws := &Winsize{} |
|
26 |
- ret, err := C.my_ioctl(C.int(fd), C.int(unix.TIOCGWINSZ), (*C.struct_winsize)(unsafe.Pointer(ws))) |
|
27 |
- // Skip retval = 0 |
|
28 |
- if ret == 0 { |
|
29 |
- return ws, nil |
|
30 |
- } |
|
31 |
- return ws, err |
|
32 |
-} |
|
33 |
- |
|
34 |
-// SetWinsize tries to set the specified window size for the specified file descriptor. |
|
35 |
-func SetWinsize(fd uintptr, ws *Winsize) error { |
|
36 |
- ret, err := C.my_ioctl(C.int(fd), C.int(unix.TIOCSWINSZ), (*C.struct_winsize)(unsafe.Pointer(ws))) |
|
37 |
- // Skip retval = 0 |
|
38 |
- if ret == 0 { |
|
39 |
- return nil |
|
40 |
- } |
|
41 |
- return err |
|
42 |
-} |
39 | 34 |
deleted file mode 100644 |
... | ... |
@@ -1,46 +0,0 @@ |
1 |
-package runconfig |
|
2 |
- |
|
3 |
-import ( |
|
4 |
- "github.com/docker/docker/api/types/container" |
|
5 |
- "github.com/docker/docker/pkg/sysinfo" |
|
6 |
-) |
|
7 |
- |
|
8 |
-// DefaultDaemonNetworkMode returns the default network stack the daemon should |
|
9 |
-// use. |
|
10 |
-func DefaultDaemonNetworkMode() container.NetworkMode { |
|
11 |
- return container.NetworkMode("bridge") |
|
12 |
-} |
|
13 |
- |
|
14 |
-// IsPreDefinedNetwork indicates if a network is predefined by the daemon |
|
15 |
-func IsPreDefinedNetwork(network string) bool { |
|
16 |
- return false |
|
17 |
-} |
|
18 |
- |
|
19 |
-// validateNetMode ensures that the various combinations of requested |
|
20 |
-// network settings are valid. |
|
21 |
-func validateNetMode(c *container.Config, hc *container.HostConfig) error { |
|
22 |
- // We may not be passed a host config, such as in the case of docker commit |
|
23 |
- return nil |
|
24 |
-} |
|
25 |
- |
|
26 |
-// validateIsolation performs platform specific validation of the |
|
27 |
-// isolation level in the hostconfig structure. |
|
28 |
-// This setting is currently discarded for Solaris so this is a no-op. |
|
29 |
-func validateIsolation(hc *container.HostConfig) error { |
|
30 |
- return nil |
|
31 |
-} |
|
32 |
- |
|
33 |
-// validateQoS performs platform specific validation of the QoS settings |
|
34 |
-func validateQoS(hc *container.HostConfig) error { |
|
35 |
- return nil |
|
36 |
-} |
|
37 |
- |
|
38 |
-// validateResources performs platform specific validation of the resource settings |
|
39 |
-func validateResources(hc *container.HostConfig, si *sysinfo.SysInfo) error { |
|
40 |
- return nil |
|
41 |
-} |
|
42 |
- |
|
43 |
-// validatePrivileged performs platform specific validation of the Privileged setting |
|
44 |
-func validatePrivileged(hc *container.HostConfig) error { |
|
45 |
- return nil |
|
46 |
-} |
... | ... |
@@ -181,7 +181,7 @@ func TestValidateName(t *testing.T) { |
181 | 181 |
} |
182 | 182 |
|
183 | 183 |
func TestCreateWithOpts(t *testing.T) { |
184 |
- if runtime.GOOS == "windows" || runtime.GOOS == "solaris" { |
|
184 |
+ if runtime.GOOS == "windows" { |
|
185 | 185 |
t.Skip() |
186 | 186 |
} |
187 | 187 |
rootDir, err := ioutil.TempDir("", "local-volume-test") |