daemon_solaris.go 4.9 KB

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