mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
86d8758e2b
Signed-off-by: Amit Krishnan <krish.amit@gmail.com>
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package runconfig
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/docker/engine-api/types/container"
|
|
)
|
|
|
|
// DefaultDaemonNetworkMode returns the default network stack the daemon should
|
|
// use.
|
|
func DefaultDaemonNetworkMode() container.NetworkMode {
|
|
return container.NetworkMode("default")
|
|
}
|
|
|
|
// IsPreDefinedNetwork indicates if a network is predefined by the daemon
|
|
func IsPreDefinedNetwork(network string) bool {
|
|
return false
|
|
}
|
|
|
|
// ValidateNetMode ensures that the various combinations of requested
|
|
// network settings are valid.
|
|
func ValidateNetMode(c *container.Config, hc *container.HostConfig) error {
|
|
// We may not be passed a host config, such as in the case of docker commit
|
|
if hc == nil {
|
|
return nil
|
|
}
|
|
parts := strings.Split(string(hc.NetworkMode), ":")
|
|
switch mode := parts[0]; mode {
|
|
case "default", "none":
|
|
default:
|
|
return fmt.Errorf("invalid --net: %s", hc.NetworkMode)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ValidateIsolation performs platform specific validation of the
|
|
// isolation level in the hostconfig structure.
|
|
// This setting is currently discarded for Solaris so this is a no-op.
|
|
func ValidateIsolation(hc *container.HostConfig) error {
|
|
return nil
|
|
}
|
|
|
|
// ValidateQoS performs platform specific validation of the QoS settings
|
|
// a disk can be limited by either Bps or IOps, but not both.
|
|
func ValidateQoS(hc *container.HostConfig) error {
|
|
return nil
|
|
}
|