github.com/kobeld/docker@v1.12.0-rc1/daemon/daemon_solaris.go (about)

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