daemon_solaris.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. // +build solaris,cgo
  2. package daemon
  3. import (
  4. "fmt"
  5. "github.com/docker/docker/api/types"
  6. containertypes "github.com/docker/docker/api/types/container"
  7. "github.com/docker/docker/container"
  8. "github.com/docker/docker/image"
  9. "github.com/docker/docker/layer"
  10. "github.com/docker/docker/pkg/idtools"
  11. "github.com/docker/docker/pkg/parsers/kernel"
  12. "github.com/docker/docker/reference"
  13. "github.com/docker/libnetwork"
  14. nwconfig "github.com/docker/libnetwork/config"
  15. )
  16. //#include <zone.h>
  17. import "C"
  18. const (
  19. defaultVirtualSwitch = "Virtual Switch"
  20. platformSupported = true
  21. solarisMinCPUShares = 1
  22. solarisMaxCPUShares = 65535
  23. )
  24. func (daemon *Daemon) cleanupMountsByID(id string) error {
  25. return nil
  26. }
  27. func parseSecurityOpt(container *container.Container, config *containertypes.HostConfig) error {
  28. return nil
  29. }
  30. func setupRemappedRoot(config *Config) ([]idtools.IDMap, []idtools.IDMap, error) {
  31. return nil, nil, nil
  32. }
  33. func setupDaemonRoot(config *Config, rootDir string, rootUID, rootGID int) error {
  34. return nil
  35. }
  36. func (daemon *Daemon) getLayerInit() func(string) error {
  37. return nil
  38. }
  39. // setupInitLayer populates a directory with mountpoints suitable
  40. // for bind-mounting dockerinit into the container. The mountpoint is simply an
  41. // empty file at /.dockerinit
  42. //
  43. // This extra layer is used by all containers as the top-most ro layer. It protects
  44. // the container from unwanted side-effects on the rw layer.
  45. func setupInitLayer(initLayer string, rootUID, rootGID int) error {
  46. return nil
  47. }
  48. func checkKernel() error {
  49. // solaris can rely upon checkSystem() below, we don't skew kernel versions
  50. return nil
  51. }
  52. func (daemon *Daemon) getCgroupDriver() string {
  53. return ""
  54. }
  55. func (daemon *Daemon) adaptContainerSettings(hostConfig *containertypes.HostConfig, adjustCPUShares bool) error {
  56. return nil
  57. }
  58. // verifyPlatformContainerSettings performs platform-specific validation of the
  59. // hostconfig and config structures.
  60. func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.HostConfig, config *containertypes.Config, update bool) ([]string, error) {
  61. warnings := []string{}
  62. return warnings, nil
  63. }
  64. // platformReload update configuration with platform specific options
  65. func (daemon *Daemon) platformReload(config *Config) map[string]string {
  66. return map[string]string{}
  67. }
  68. // verifyDaemonSettings performs validation of daemon config struct
  69. func verifyDaemonSettings(config *Config) error {
  70. // checkSystem validates platform-specific requirements
  71. return nil
  72. }
  73. func checkSystem() error {
  74. // check OS version for compatibility, ensure running in global zone
  75. var err error
  76. var id C.zoneid_t
  77. if id, err = C.getzoneid(); err != nil {
  78. return fmt.Errorf("Exiting. Error getting zone id: %+v", err)
  79. }
  80. if int(id) != 0 {
  81. return fmt.Errorf("Exiting because the Docker daemon is not running in the global zone")
  82. }
  83. v, err := kernel.GetKernelVersion()
  84. if kernel.CompareKernelVersion(*v, kernel.VersionInfo{Kernel: 5, Major: 12, Minor: 0}) < 0 {
  85. return fmt.Errorf("Your Solaris kernel version: %s doesn't support Docker. Please upgrade to 5.12.0", v.String())
  86. }
  87. return err
  88. }
  89. // configureMaxThreads sets the Go runtime max threads threshold
  90. // which is 90% of the kernel setting from /proc/sys/kernel/threads-max
  91. func configureMaxThreads(config *Config) error {
  92. return nil
  93. }
  94. // configureKernelSecuritySupport configures and validate security support for the kernel
  95. func configureKernelSecuritySupport(config *Config, driverName string) error {
  96. return nil
  97. }
  98. func (daemon *Daemon) initNetworkController(config *Config, activeSandboxes map[string]interface{}) (libnetwork.NetworkController, error) {
  99. return nil, nil
  100. }
  101. // registerLinks sets up links between containers and writes the
  102. // configuration out for persistence.
  103. func (daemon *Daemon) registerLinks(container *container.Container, hostConfig *containertypes.HostConfig) error {
  104. return nil
  105. }
  106. func (daemon *Daemon) cleanupMounts() error {
  107. return nil
  108. }
  109. // conditionalMountOnStart is a platform specific helper function during the
  110. // container start to call mount.
  111. func (daemon *Daemon) conditionalMountOnStart(container *container.Container) error {
  112. return nil
  113. }
  114. // conditionalUnmountOnCleanup is a platform specific helper function called
  115. // during the cleanup of a container to unmount.
  116. func (daemon *Daemon) conditionalUnmountOnCleanup(container *container.Container) error {
  117. return daemon.Unmount(container)
  118. }
  119. func restoreCustomImage(is image.Store, ls layer.Store, rs reference.Store) error {
  120. // Solaris has no custom images to register
  121. return nil
  122. }
  123. func driverOptions(config *Config) []nwconfig.Option {
  124. return []nwconfig.Option{}
  125. }
  126. func (daemon *Daemon) stats(c *container.Container) (*types.StatsJSON, error) {
  127. return nil, nil
  128. }
  129. // setDefaultIsolation determine the default isolation mode for the
  130. // daemon to run in. This is only applicable on Windows
  131. func (daemon *Daemon) setDefaultIsolation() error {
  132. return nil
  133. }
  134. func rootFSToAPIType(rootfs *image.RootFS) types.RootFS {
  135. return types.RootFS{}
  136. }
  137. func setupDaemonProcess(config *Config) error {
  138. return nil
  139. }
  140. // verifyVolumesInfo is a no-op on solaris.
  141. // This is called during daemon initialization to migrate volumes from pre-1.7.
  142. // Solaris was not supported on pre-1.7 daemons.
  143. func (daemon *Daemon) verifyVolumesInfo(container *container.Container) error {
  144. return nil
  145. }