github.com/kim0/docker@v0.6.2-0.20161130212042-4addda3f07e7/daemon/daemon_solaris.go (about)

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