зеркало из https://github.com/microsoft/docker.git
daemon: remove unused function params
Signed-off-by: Antonio Murdaca <runcom@linux.com>
This commit is contained in:
Родитель
5ff63b6946
Коммит
587823af27
|
@ -509,7 +509,7 @@ func (container *Container) buildSandboxOptions() ([]libnetwork.SandboxOption, e
|
||||||
return sboxOptions, nil
|
return sboxOptions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *Container) buildPortMapInfo(n libnetwork.Network, ep libnetwork.Endpoint, networkSettings *network.Settings) (*network.Settings, error) {
|
func (container *Container) buildPortMapInfo(ep libnetwork.Endpoint, networkSettings *network.Settings) (*network.Settings, error) {
|
||||||
if ep == nil {
|
if ep == nil {
|
||||||
return nil, fmt.Errorf("invalid endpoint while building port map info")
|
return nil, fmt.Errorf("invalid endpoint while building port map info")
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ func (container *Container) buildPortMapInfo(n libnetwork.Network, ep libnetwork
|
||||||
return networkSettings, nil
|
return networkSettings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *Container) buildEndpointInfo(n libnetwork.Network, ep libnetwork.Endpoint, networkSettings *network.Settings) (*network.Settings, error) {
|
func (container *Container) buildEndpointInfo(ep libnetwork.Endpoint, networkSettings *network.Settings) (*network.Settings, error) {
|
||||||
if ep == nil {
|
if ep == nil {
|
||||||
return nil, fmt.Errorf("invalid endpoint while building port map info")
|
return nil, fmt.Errorf("invalid endpoint while building port map info")
|
||||||
}
|
}
|
||||||
|
@ -636,12 +636,12 @@ func (container *Container) updateJoinInfo(ep libnetwork.Endpoint) error {
|
||||||
func (container *Container) updateEndpointNetworkSettings(n libnetwork.Network, ep libnetwork.Endpoint) error {
|
func (container *Container) updateEndpointNetworkSettings(n libnetwork.Network, ep libnetwork.Endpoint) error {
|
||||||
networkSettings := &network.Settings{NetworkID: n.ID(), EndpointID: ep.ID()}
|
networkSettings := &network.Settings{NetworkID: n.ID(), EndpointID: ep.ID()}
|
||||||
|
|
||||||
networkSettings, err := container.buildPortMapInfo(n, ep, networkSettings)
|
networkSettings, err := container.buildPortMapInfo(ep, networkSettings)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
networkSettings, err = container.buildEndpointInfo(n, ep, networkSettings)
|
networkSettings, err = container.buildEndpointInfo(ep, networkSettings)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,13 +170,7 @@ func (daemon *Daemon) load(id string) (*Container, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register makes a container object usable by the daemon as <container.ID>
|
// Register makes a container object usable by the daemon as <container.ID>
|
||||||
// This is a wrapper for register
|
|
||||||
func (daemon *Daemon) Register(container *Container) error {
|
func (daemon *Daemon) Register(container *Container) error {
|
||||||
return daemon.register(container, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
// register makes a container object usable by the daemon as <container.ID>
|
|
||||||
func (daemon *Daemon) register(container *Container, updateSuffixarray bool) error {
|
|
||||||
if container.daemon != nil || daemon.Exists(container.ID) {
|
if container.daemon != nil || daemon.Exists(container.ID) {
|
||||||
return fmt.Errorf("Container is already loaded")
|
return fmt.Errorf("Container is already loaded")
|
||||||
}
|
}
|
||||||
|
@ -319,7 +313,7 @@ func (daemon *Daemon) restore() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := daemon.register(container, false); err != nil {
|
if err := daemon.Register(container); err != nil {
|
||||||
logrus.Debugf("Failed to register container %s: %s", container.ID, err)
|
logrus.Debugf("Failed to register container %s: %s", container.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,29 +33,28 @@ func TestGetVolumeDriver(t *testing.T) {
|
||||||
|
|
||||||
func TestParseBindMount(t *testing.T) {
|
func TestParseBindMount(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
bind string
|
bind string
|
||||||
driver string
|
driver string
|
||||||
expDest string
|
expDest string
|
||||||
expSource string
|
expSource string
|
||||||
expName string
|
expName string
|
||||||
expDriver string
|
expDriver string
|
||||||
mountLabel string
|
expRW bool
|
||||||
expRW bool
|
fail bool
|
||||||
fail bool
|
|
||||||
}{
|
}{
|
||||||
{"/tmp:/tmp", "", "/tmp", "/tmp", "", "", "", true, false},
|
{"/tmp:/tmp", "", "/tmp", "/tmp", "", "", true, false},
|
||||||
{"/tmp:/tmp:ro", "", "/tmp", "/tmp", "", "", "", false, false},
|
{"/tmp:/tmp:ro", "", "/tmp", "/tmp", "", "", false, false},
|
||||||
{"/tmp:/tmp:rw", "", "/tmp", "/tmp", "", "", "", true, false},
|
{"/tmp:/tmp:rw", "", "/tmp", "/tmp", "", "", true, false},
|
||||||
{"/tmp:/tmp:foo", "", "/tmp", "/tmp", "", "", "", false, true},
|
{"/tmp:/tmp:foo", "", "/tmp", "/tmp", "", "", false, true},
|
||||||
{"name:/tmp", "", "/tmp", "", "name", "local", "", true, false},
|
{"name:/tmp", "", "/tmp", "", "name", "local", true, false},
|
||||||
{"name:/tmp", "external", "/tmp", "", "name", "external", "", true, false},
|
{"name:/tmp", "external", "/tmp", "", "name", "external", true, false},
|
||||||
{"name:/tmp:ro", "local", "/tmp", "", "name", "local", "", false, false},
|
{"name:/tmp:ro", "local", "/tmp", "", "name", "local", false, false},
|
||||||
{"local/name:/tmp:rw", "", "/tmp", "", "local/name", "local", "", true, false},
|
{"local/name:/tmp:rw", "", "/tmp", "", "local/name", "local", true, false},
|
||||||
{"/tmp:tmp", "", "", "", "", "", "", true, true},
|
{"/tmp:tmp", "", "", "", "", "", true, true},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
m, err := parseBindMount(c.bind, c.mountLabel, c.driver)
|
m, err := parseBindMount(c.bind, c.driver)
|
||||||
if c.fail {
|
if c.fail {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("Expected error, was nil, for spec %s\n", c.bind)
|
t.Fatalf("Expected error, was nil, for spec %s\n", c.bind)
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (container *Container) setupMounts() ([]execdriver.Mount, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseBindMount validates the configuration of mount information in runconfig is valid.
|
// parseBindMount validates the configuration of mount information in runconfig is valid.
|
||||||
func parseBindMount(spec, mountLabel, volumeDriver string) (*mountPoint, error) {
|
func parseBindMount(spec, volumeDriver string) (*mountPoint, error) {
|
||||||
bind := &mountPoint{
|
bind := &mountPoint{
|
||||||
RW: true,
|
RW: true,
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc
|
||||||
// 3. Read bind mounts
|
// 3. Read bind mounts
|
||||||
for _, b := range hostConfig.Binds {
|
for _, b := range hostConfig.Binds {
|
||||||
// #10618
|
// #10618
|
||||||
bind, err := parseBindMount(b, container.MountLabel, hostConfig.VolumeDriver)
|
bind, err := parseBindMount(b, hostConfig.VolumeDriver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче