daemon_solaris.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. // verifyDaemonSettings performs validation of daemon config struct
  62. func verifyDaemonSettings(config *Config) error {
  63. // checkSystem validates platform-specific requirements
  64. return nil
  65. }
  66. func checkSystem() error {
  67. // check OS version for compatibility, ensure running in global zone
  68. var err error
  69. var id C.zoneid_t
  70. if id, err = C.getzoneid(); err != nil {
  71. return fmt.Errorf("Exiting. Error getting zone id: %+v", err)
  72. }
  73. if int(id) != 0 {
  74. return fmt.Errorf("Exiting because the Docker daemon is not running in the global zone")
  75. }
  76. v, err := kernel.GetKernelVersion()
  77. if kernel.CompareKernelVersion(*v, kernel.VersionInfo{Kernel: 5, Major: 12, Minor: 0}) < 0 {
  78. return fmt.Errorf("Your Solaris kernel version: %s doesn't support Docker. Please upgrade to 5.12.0", v.String())
  79. }
  80. return err
  81. }
  82. // configureMaxThreads sets the Go runtime max threads threshold
  83. // which is 90% of the kernel setting from /proc/sys/kernel/threads-max
  84. func configureMaxThreads(config *Config) error {
  85. return nil
  86. }
  87. // configureKernelSecuritySupport configures and validate security support for the kernel
  88. func configureKernelSecuritySupport(config *Config, driverName string) error {
  89. return nil
  90. }
  91. func (daemon *Daemon) initNetworkController(config *Config) (libnetwork.NetworkController, error) {
  92. return nil, nil
  93. }
  94. // registerLinks sets up links between containers and writes the
  95. // configuration out for persistence.
  96. func (daemon *Daemon) registerLinks(container *container.Container, hostConfig *containertypes.HostConfig) error {
  97. return nil
  98. }
  99. func (daemon *Daemon) cleanupMounts() error {
  100. return nil
  101. }
  102. // conditionalMountOnStart is a platform specific helper function during the
  103. // container start to call mount.
  104. func (daemon *Daemon) conditionalMountOnStart(container *container.Container) error {
  105. return nil
  106. }
  107. // conditionalUnmountOnCleanup is a platform specific helper function called
  108. // during the cleanup of a container to unmount.
  109. func (daemon *Daemon) conditionalUnmountOnCleanup(container *container.Container) error {
  110. return daemon.Unmount(container)
  111. }
  112. func restoreCustomImage(is image.Store, ls layer.Store, rs reference.Store) error {
  113. // Solaris has no custom images to register
  114. return nil
  115. }
  116. func driverOptions(config *Config) []nwconfig.Option {
  117. return []nwconfig.Option{}
  118. }
  119. func (daemon *Daemon) stats(c *container.Container) (*types.StatsJSON, error) {
  120. return nil, nil
  121. }
  122. // setDefaultIsolation determine the default isolation mode for the
  123. // daemon to run in. This is only applicable on Windows
  124. func (daemon *Daemon) setDefaultIsolation() error {
  125. return nil
  126. }
  127. func rootFSToAPIType(rootfs *image.RootFS) types.RootFS {
  128. return types.RootFS{}
  129. }